• Docs
  • Blog
    • 0.24.0

    • Switch to dark mode
    Get Started
    Components
    Styling
    Theming

    Concepts

    OverviewCompositionTesting

    Layout

    Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

    Components

    AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

    Utilities

    Feature FlagsForLocal StoragePortalShowsplitPropsTheme

    Checkbox

    The Checkbox component allows users to select one or more options from a set.

    • npm
    • source
    • recipe
    • Ark
    import { Checkbox, CheckboxGroup, CheckboxParts } from '@cerberus/react'

    Usage

    The Checkbox component is a controlled component that can be used to select one or more options from a set. It can be used in a group with other checkboxes to allow for multiple selections.

    Indeterminate State

    The Checkbox component supports the indeterminate state, which is useful for indicating that a group of checkboxes is in a mixed state. To enable this state, set the checked prop to indeterminate.

    Sizes

    The Checkbox component supports different sizes. You can set the size prop to sm, or md.

    Primitives

    You can utilize the primitive components or the css prop to customize the checkbox.

    ComponentDescription
    CheckboxRootThe context provider for the Checkbox parts
    CheckboxLabelThe label of the checkbox
    CheckboxControlThe input of the checkbox
    CheckboxIndicatorThe indicator of the checkbox state
    CheckboxGroupThe group container for multiple checkboxes
    CheckboxHiddenInputThe native input for the checkbox

    API

    Props

    The Checkbox component is an abstraction of the primitives and accepts the following props:

    NameDefaultDescription
    sizesmThis size of the Checkbox.

    The Checkbox component also accepts all the props of the CheckboxRoot primitive props

    Parts

    The CheckboxParts API is an Object containing the full family of components.

    Note

    It is best to only use the CheckboxParts if you are building a custom solution. Importing Object based components will ship every property it includes into your bundle, regardless if you use it or not.

    NameDescription
    RootThe CheckboxRoot component which is the Provider for the family.
    LabelThe CheckboxLabel component which displays the label and "required" notice.
    ControlThe CheckboxControl component which is the visual field.
    IndicatorThe CheckboxIndicator component which displays based on the checked state.
    GroupThe CheckboxGroup component which creates a controls the spacing of a group.
    HiddenInputThe CheckboxHiddenInput component which displays the native input.

    On this page

    • Edit this page on Github
    Cerberus Design System | Docs