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.0.2
usageimport {useCheckboxGroupState} from '@react-stately/checkbox'

API#


useCheckboxGroupState( (props: CheckboxGroupProps )): CheckboxGroupState

Interface#


Properties

NameTypeDescription
valueCurrent selected values.
isDisabledbooleanWhether the checkbox group is disabled.
isReadOnlybooleanWhether the checkbox group is read only.

Methods

MethodDescription
isSelected( (value: string )): booleanReturns whether the given value is selected.
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.