Checkbox Group
Provides shared state to a series of checkboxes.
Apples
API reference
Checkbox Group is composed together with Checkbox. Import the components and place them together:
Anatomy
import { Checkbox } from '@base-ui-components/react/checkbox';
import { CheckboxGroup } from '@base-ui-components/react/checkbox-group';
<CheckboxGroup>
<Checkbox.Root />
</CheckboxGroup>
Prop | Type | Default | |
---|---|---|---|
defaultValue |
|
| |
value |
|
| |
onValueChange |
|
| |
allValues |
|
| |
disabled |
|
| |
className |
|
| |
render |
|
|
Attribute | Description | |
---|---|---|
data-disabled | Present when the checkbox group is disabled. |
Examples
Parent checkbox
A checkbox that controls other checkboxes within a CheckboxGroup
can be created:
- Make
CheckboxGroup
a controlled component - Pass an array of all the child checkbox
name
s to theCheckboxGroup
’sallValues
prop - Add the
parent
boolean prop to the parentCheckbox