Checkbox Group

Provides shared state to a series of checkboxes.

Apples

Anatomy

Checkbox Group is composed together with Checkbox. Import the components and place them together:

Anatomy

API reference

PropTypeDefault
defaultValue

string[]

undefined

value

string[]

undefined

onValueChange

((value: string[], event: Event) => void)

undefined

allValues

string[]

undefined

disabled

boolean

false

className

| string
| ((state: Checkbox.Group.State) => string)

undefined

render

| ReactElement
| ((props: HTMLProps, state: Checkbox.Group.State) => ReactElement)

undefined

Attribute
Description
data-disabled

Examples

Parent checkbox

A checkbox that controls other checkboxes within a CheckboxGroup can be created:

  1. Make CheckboxGroup a controlled component
  2. Pass an array of all the child checkbox values to the CheckboxGroup’s allValues prop
  3. Add the parent boolean prop to the parent Checkbox

Nested parent checkbox

Form integration

To use checkbox group in a form, pass the checkbox group’s name to a Field, then use the render prop to render the field as a Fieldset in order to label the group.

Using CheckboxGroup in a form
Extra toppings