useMultipleSelectionState

Manages state for multiple selection and focus in a collection.

installyarn add @react-stately/selection
version3.0.0-alpha.1
usageimport {useMultipleSelectionState} from '@react-stately/selection'

Introduction#


useMultipleSelectionState manages selection state for many components. Oftentimes, you won't need to use this hook directly, since it's included in hooks like useListState, and useSelectState. These expose a SelectionManager, which provides a higher level way to manipulate selection state.

API#


useMultipleSelectionState( (props: MultipleSelection )): MultipleSelectionState

Interface#


Properties

NameTypeDescription
selectionModeSelectionMode
disallowEmptySelectionboolean
selectedKeysSelection
isFocusedboolean
focusedKeyKey

Methods

MethodDescription
setSelectedKeys( (keys: Selection( (v: Selection )) => Selection )): void
setFocused( (isFocused: boolean )): void
setFocusedKey( (key: Key )): void