useCheckboxGroupState
Provides state management for a checkbox group component. Provides a name for the group, and manages selection and focus state.
install | yarn add @react-stately/checkbox |
---|---|
version | 3.0.7 |
usage | import {useCheckboxGroupState} from '@react-stately/checkbox' |
API#
useCheckboxGroupState(
(props: CheckboxGroupProps
)): CheckboxGroupState
Interface#
Properties
Name | Type | Description |
value |
| Current selected values. |
isDisabled | boolean | Whether the checkbox group is disabled. |
isReadOnly | boolean | Whether the checkbox group is read only. |
Methods
Method | Description |
isSelected(
(value: string
)): boolean | Returns whether the given value is selected. |
setValue(
(value: string[]
)): void | Sets the selected values. |
addValue(
(value: string
)): void | Adds a value to the set of selected values. |
removeValue(
(value: string
)): void | Removes a value from the set of selected values. |
toggleValue(
(value: string
)): void | Toggles a value in the set of selected values. |