CheckboxGroup
Collect multiple choices as one array-valued field.
Use CheckboxGroup for several choices submitted as one array. Use individual Checkbox controls when the fields are independent.
Basic usage#
Playground#
Anatomy#
The nested <fieldset> owns group semantics and the optional <legend> association.
Usage#
Selection model#
The group value is an array of item values. Pair value with onValueChange for controlled selection, or use a default value when the group owns its initial state. A disabled group disables all items; an item can also be disabled independently.
Forms#
Give the group a name for native form submission, or place it inside form.Field from
createForm for schema binding. Standalone Field supplies
labels and messages without validation. Each checkbox keeps its own tab stop; the group does not
use radio-style arrow navigation.
Examples#
Controlled value and disabled items#
Custom indicator#
Form integration#
Attributes#
data-disabledSlot: checkbox-group, checkbox-group-item, checkbox-control, checkbox-indicatorDescription: Present when the component, slot, or item is disabled.data-invalidSlot: checkbox-group, checkbox-group-item, checkbox-controlDescription: Present when the field or form has a validation error.data-readonlySlot: checkbox-group, checkbox-group-item, checkbox-controlDescription: Present when the field is in read-only mode.data-requiredSlot: checkbox-group, checkbox-group-legend, checkbox-group-item, checkbox-control, checkbox-labelDescription: Present when the field input is required.data-checkedSlot: checkbox-group-item, checkbox-control, checkbox-indicatorDescription: Present when the item or toggle is checked.data-indeterminateSlot: checkbox-group-item, checkbox-control, checkbox-indicatorDescription: Present when the checkbox or progress state is indeterminate.data-uncheckedSlot: checkbox-group-item, checkbox-controlDescription: Present when the checkbox, radio item, or switch is unchecked.Props#
Props for the CheckboxGroup component. Renders a <div> element by default.