useListState
Provides state management for list-like components. Handles building a collection of items from props, and manages multiple selection state.
install | yarn add react-stately |
---|---|
version | 3.27.0 |
usage | import {useListState} from 'react-stately' |
API#
useListState<T extends object>(
(props: ListProps<T>
)): ListState<T>
Interface#
Name | Type | Description |
collection | Collection<Node<T>> | A collection of items in the list. |
disabledKeys | Set<Key> | A set of items that are disabled. |
selectionManager | SelectionManager | A selection manager to read and update multiple selection state. |
Example#
See the docs for useListBox in react-aria for an example of useListState
.