Grapes homepage1.57.0
  • Guide
  • Tokens
  • Components
    Grapes on GithubGrapes on Figma
    Interaction
    • Button
    • IconButton
    • FloatingActionBar
    • Link
    Icons
    • Icon
    • HighlightIcon
    Form
    • AmountInput
    • Autocomplete
    • AutocompleteMultiple
    • AutocompletePlace
    • CheckboxBox
    • CheckboxField
    • DatePicker
    • FormField
    • Input
    • OptionGroup
    • PasswordInput
    • PhoneInput
    • RadioBox
    • RadioField
    • RadioGroup
    • Select
    • SwitchField
    • TextArea
    • TextInput
    • Upload
    • UploadButton
    Feedback
    • Badge
    • Banner
    • Callout
    • EmptyState
    • Modal
    • ModalSlideshow
    • DeprecatedModalSlideshow
    • PageModal
    • Skeleton
    • Tag
    • Toast
    • Tooltip
    Data display
    • Accordion
    • Avatar
    • Box
    • Calendar
    • CalendarRange
    • CollapsibleList
    • FileCard
    • InfoTip
    • ListBox
    • ListView
    • Panel
    • SidePanel
    • DeprecatedPreview
    • Table
    • Timeline
    • useDateFormatter
    Navigation
    • DropdownItem
    • DropdownMenu
    • Navigation
    • NavigationItem
    • Popover
    • Tabs

    CheckboxBox

    Checkboxes allow the user to select one or more items from a collection.

    View source code
    • Usage
    • Props

    Basic usage

    const Demo = () => {
      const [isAdministrator, setAdministrator] = useState<boolean>(false);
    
      return (
        <CheckboxBox
          label="Administrator"
          description="An admin can set up the account: invite new members, edit approval policies and team composition"
          isChecked={isAdministrator}
          onChange={(e) => setAdministrator(e.target.checked)}
        />
      );
    };
    

    With an icon

    Use the iconName prop to add an icon to the CheckboxBox.

    const Demo = () => {
      const [isAdministrator, setAdministrator] = useState<boolean>(false);
    
      return (
        <CheckboxBox
          label="Administrator"
          description="An admin can set up the account: invite new members, edit approval policies and team composition"
          iconName="person"
          isChecked={isAdministrator}
          onChange={(e) => setAdministrator(e.target.checked)}
        />
      );
    };
    

    Without the description

    The description prop is optional.

    const Demo = () => {
      const [isAdministrator, setAdministrator] = useState<boolean>(false);
    
      return (
        <CheckboxBox
          label="Administrator"
          isChecked={isAdministrator}
          onChange={(e) => setAdministrator(e.target.checked)}
        />
      );
    };
    

    Indeterminate state

    Use isIndeterminate to set the checkbox into an indeterminate state.

    const Demo = () => {
      const [isAdministrator, setAdministrator] = useState<boolean>(false);
    
      return (
        <CheckboxBox
          label="Administrator"
          isIndeterminate={true} 
          isChecked={isAdministrator}
          onChange={(e) => setAdministrator(e.target.checked)}
        />
      );
    };