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/list |
---|---|
version | 3.4.4 |
usage | import {useListState} from '@react-stately/list' |
API#
useListState<T>(
(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
.