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
version3.27.0
usageimport {useCheckboxGroupState} from 'react-stately'

API#


useCheckboxGroupState( (props: CheckboxGroupProps )): CheckboxGroupState

Interface#


Properties

NameTypeDescription
valuereadonly string[]Current selected values.
isDisabledbooleanWhether the checkbox group is disabled.
isReadOnlybooleanWhether the checkbox group is read only.
isInvalidbooleanWhether the checkbox group is invalid.

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.