An interface for reading and updating multiple selection state.
SelectionManager provides a generic interface for reading and
updating selection and focus state based on a
As discussed in the selection introduction, a selection is represented
by a Set of item keys. Focus
is represented by a single item key.
Focus state is updated when navigating a collection with the keyboard. Selection state is updated when a user
clicks or taps an item, or uses the keyboard to select an item. These interactions are handled by
useSelectableCollection hook in react-aria.
SelectionManager wraps the state returned by
Oftentimes, you won't need to construct these directly because hooks like
useTreeState already handle this and return
SelectionManager for you.
|The type of selection that is allowed in the collection.|
|Whether the collection allows empty selection.|
|Whether the collection is currently focused.|
|The current focused key in the collection.|
|Whether the first or last child of the focused key should receive focus.|
|The currently selected keys in the collection.|
|Whether the selection is empty.|
|Whether all items in the collection are selected.|
|Sets whether the collection is focused.|
|Sets the focused key.|
|Returns whether a key is selected.|
|Extends the selection to the given key.|
|Toggles whether the given key is selected.|
|Replaces the selection with only the given key.|
|Selects all items in the collection.|
|Removes all keys from the selection.|
|Toggles between select all and an empty selection.|