UseListParameters
Properties
The name of the component using useList. For debugging purposes.
The externally controlled values (highlighted and selected item(s)) of the list. If a custom state is used, this object can contain the added state fields as well.
If true
, it will be possible to highlight disabled items.
If true
, the highlight will not wrap around the list if arrow keys are used.
The focus management strategy used by the list. Controls the attributes used to set focus on the list items.
A function that intializes the state of the list. It is required when using a custom state with mandatory fields. If not provided, the state will be initialized with the default values (nothing highlighted or selected).
A function that converts an object to its string representation
A function that returns the DOM element associated with an item. This is required when using the DOM
focus management.
A function that determines if a particular item is disabled.
A function that tests equality between two items' values.
Array of list items.
Callback fired when the selected value changes. This is a strongly typed convenience event that can be used instead of onStateChange
.
Callback fired when the highlighted option changes. This is a strongly typed convenience event that can be used instead of onStateChange
.
Callback fired when the items change.
Callback fired when the any of the state items change. Note that in case of selectedValues
and highlightedValue
the strongly typed onChange
and onHighlightChange
callbacks are also fired.
Orientation of the items in the list. Determines the actions that are performed when arrow keys are pressed.
Additional data to be passed to all the reducer actions. It will be available in the context
property of the action when dispatched.
Controls how many items can be selected at once: none (the selection functionality is disabled in this case), one, or indefinitely many.
Custom state reducer function. It calculates the new state (highlighted and selected items + optional custom state) based on the previous one and the performed action.