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.

Required

Use required on a Checkbox to indicate that this specific option must be checked, such as an agreement the user must accept.

The preview has been updated.

Unlike a Radio Group, a Checkbox Group has no built-in way to require selection. Refer to the Guidelines tab for an example of how you can use state to enforce minimum and maximum selections.

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.

Related