useListState

Provides state management for list-like components. Handles building a collection of items from props, and manages multiple selection state.

installyarn add @react-stately/list
version3.4.1
usageimport {useListState} from '@react-stately/list'

API#


useListState<T>( (props: ListProps<T> )): ListState<T>

Interface#


NameTypeDescription
collectionCollection<Node<T>>A collection of items in the list.
disabledKeysSet<Key>A set of items that are disabled.
selectionManagerSelectionManagerA selection manager to read and update multiple selection state.

Example#


See the docs for useListBox in react-aria for an example of useListState.