Checkbox Group

Used for choosing multiple options from a group of related choices, such as filters.

Use Checkbox Group...

  • When multiple related options from a group can be selected.

Don't use Checkbox Group...

  • When the user must choose exactly one option from a group. Use Radio Group instead.
  • For selectable buttons, cards, tiles, or color swatches. Use Choice Group instead.
  • For a standalone option. Use Checkbox instead.

The preview has been updated.

Disabled

Use disabled on any Checkboxes within Checkbox Group to prevent them from being selected or deselected.

To disable the entire group, use disabled on each item.

The preview has been updated.

Labels, errors, and helper text

Use the FormField components to add a label, error message, or helper text to a Checkbox Group. They apply the necessary ARIA attributes for you, so you don't need to add them yourself.

Managing State

Controlled

Use selection and onSelectionChange on Checkbox Group to control the selected values. selection is an array of the values of the currently selected Checkbox components, or an empty array ([]) if nothing is selected. onSelectionChange receives the updated array and the native change event. Update your state in the handler so the group reflects the new selection.

The preview has been updated.

Uncontrolled

Omit selectedValues to allow the browser to manage the state. Optionally, use defaultSelectedValues to set the initially selected values, and/or pass onSelectedValuesChange to react to changes (for example, to track the selection) without taking over the state.

The preview has been updated.

Accessibility

Both Checkbox Group and Checkbox must have a localized accessible name.

Checkbox Group

Use a FormLabel to provide a visible and accessible name (recommended, see Labels, helpers, and error text). Alternatively, use custom ARIA labels (see Accessibility guidelines).

Checkbox

Refer to the Checkbox usage guidelines.

Select All

For a “select all” and/or “clear all” experience, use a standalone Checkbox alongside your Checkbox Group to toggle the selection.

The preview has been updated.

Indeterminate

To communicate a “mixed selection state”, use indeterminate on the standalone Checkbox when only some are selected.

The preview has been updated.

Min and Max

Unlike a Radio Group, a Checkbox Group has no built-in way to require how many options are selected.

To enforce a minimum number of selections, you can show a FormError when the number of selected values doesn’t meet the minimum.

The preview has been updated.

To enforce a maximum number of selections, you can show a FormHelper once the number of selected values meets the maximum, and disable the remaining unselected options.

The preview has been updated.

Props

See core props for additional props that can be applied to each of these components. Each component also accepts the React-equivalent native HTML attributes of the element it renders, unless a listed prop replaces one or a note says otherwise.
CheckboxGroup
Renders <div>.
proptyperequireddefault
name
The shared `name` attribute for the group's `Choice` inputs. Optional and unset by default -- checkboxes don't need one to behave correctly.
string
false
null
selectedValues
The currently selected values, or `[]` if nothing is selected. Used when controlling the state of the component.
string[]
false
null
defaultSelectedValues
The default selected values. Used when not controlling the state of the component.
string[]
false
null
onSelectedValuesChange
Called with the updated selection when a `Choice` within this group is toggled.
((selectedValues: string[], event: ChangeEvent<HTMLInputElement, Element>) => void)
false
null
Checkbox
Renders <input>. With content, renders a div; the ref and input attributes target its inner input.
proptyperequireddefault
name
The `name` submitted with a form, when used standalone. Has no effect inside a `CheckboxGroup`, which sets the name for all of its options from its own `name` prop.
string
false
null
defaultChecked
Whether the checkbox starts checked, when used standalone and uncontrolled. Has no effect inside a `CheckboxGroup`, which controls it from its own `defaultSelectedValues`.
boolean
false
null
value
A string representing the value of this choice.
stringnumberreadonly string[]
false
null
checked
Whether the checkbox is checked, when used standalone and controlled. Has no effect inside a `CheckboxGroup`, which controls it from its own `selectedValues`.
boolean
false
null
skin
The visual style of the Checkbox.
"standard""favorite"null
false
standard
instant
If set to true, the checkbox will animate instantly.
booleannull
false
false
indeterminate
An indeterminate checkbox means that its state is unclear. Typically, this is used when the checkbox has some sub-options under it.
booleannull
false
false

Related