The item object is passed to the function, which returns an < Item>.Unique keys#All items in a collection must have a unique key or id, which is used to determine what items in the collection changed when updates occur. By default, React Spectrum looks for an id or key property on ...
revert(): void Resets the input value to the previously selected item's text if any and closes the menu. setFocused(isFocused: boolean): void Sets whether the select is focused. setSelectedKey(key: Key | null): void Sets the selected key. setOpen(isOpen: boolean): void Sets whether th...
let index = Math.min( ( diff > 1 ? Math.max(startItem?.index - diff + 1, 0) : startItem?.index ), itemNodes.length - 1); Version@react-stately/data v 3.11.0What browsers are you seeing the problem on?ChromeIf other, please specify.No response...
function Tab({item, state}) { let {key, rendered} = item; let ref = React.useRef(); let {tabProps} = useTab({key}, state, ref); let isSelected = state.selectedKey === key; let isDisabled = state.disabledKeys.has(key); return ( {item.rendered} ); } function TabPanel({s...
name}</Item>} </ComboBox>Dynamic data#When data in a collection changes, the selection state may need to be updated accordingly. For example, if a selected item is deleted, it should be removed from the set of selected keys. You can do this yourself, but the useListData...
Method Description toggleKey(key: Key): void Toggles the expanded state for an item by its key. setExpandedKeys(keys: Set<Key>): void Replaces the set of expanded keys.Example#See the docs for useMenu in react-aria for an example of useTreeState.Contents...
getItems(key: Key): DragItem[] Returns the items to drag for the given key. startDrag(key: Key, event: DragStartEvent): void Begins a drag for the given key. This triggers the onDragStart event. moveDrag(event: DragMoveEvent): void Triggers an onDragMove event. endDrag(event: ...