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
version3.33.0
usageimport {useListState} from 'react-stately'

API#


useListState<T extends object>( (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.