useSingleSelectListState

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

installyarn add @react-stately/list
version3.2.1
usageimport {useSingleSelectListState} from '@react-stately/list'

API#


useSingleSelectListState<T>( (props: <T> )): <T>

Interface#


Properties

NameTypeDescription
selectedKeyKeyThe key for the currently selected item.
selectedItem<T>The value of the currently selected item.
collection<<T>>A collection of items in the list.
disabledKeysSet<Key>A set of items that are disabled.
selectionManagerA selection manager to read and update multiple selection state.

Methods

MethodDescription
setSelectedKey( (key: Key )): voidSets the selected key.