useCheckboxGroupState

Provides state management for a checkbox group component. Provides a name for the group, and manages selection and focus state.

installyarn add @react-stately/checkbox
version3.1.0
usageimport {useCheckboxGroupState} from '@react-stately/checkbox'

API#


useCheckboxGroupState( (props: CheckboxGroupProps )): CheckboxGroupState

Interface#


Properties

NameTypeDescription
namestringThe name for the group, used for native form submission.
valueCurrent selected values.

Methods

MethodDescription
setValue( (value: string[] )): voidSets the selected values.
addValue( (value: string )): voidAdds a value to the set of selected values.
removeValue( (value: string )): voidRemoves a value from the set of selected values.
toggleValue( (value: string )): voidToggles a value in the set of selected values.