API reference
@salmonui/dropdowns/listbox
25 exported symbols: 1 component, 2 functions, 13 interfaces, 8 types and 1 constant. Each name links its page with the signature, docs and members.
import { … } from '@salmonui/dropdowns/listbox';Components
ListboxA persistent list of options (WAI-ARIA APG listbox) with single or multiple selection. ref receives the role="listbox" element.
Functions
moveItemsMoves the items whose values are in values from source to target, inserted at index of target (default: the end), in source order. Returns [nextSource, nextTar…reorderItemsMoves the items whose values are in values by delta positions (negative: up), keeping their relative order; items stop at the ends of the list (a block that re…
Interfaces
ListboxBasePropsProps shared by single and multiple Listbox.ListboxDataSourceA remote list: any @salmonui/data source (createJsonDataSource, createOfflineDataSource, ...). Reads use the search text, a range, and totalRowCount.ListboxDragEventonItemDrag argument, at most once per animation frame.ListboxDragStartEventonItemDragStart argument; preventDefault() cancels the drag.ListboxDropEventonItemDrop argument, fired on the receiving list.ListboxItemPropsPure per-item props from getItemProps (rendered items only).ListboxItemStaterenderItem argument.ListboxLocaleTextStatic texts of Listbox. Plain JSON, safe to pass from a server component.ListboxMultiplePropsMultiple selection.ListboxQueryBase query merged into every remote read.ListboxReorderEventonReorder argument: the application applies it to its data (reorderItems / moveItems).ListboxSinglePropsSingle selection (default).ListboxValueChangeEventSecond argument of onValueChange: frozen, read-only.
Types
ListboxEventSourceWhere a change came from.ListboxKeyAn item value: one stable, unique key per item (getItemValue).ListboxLocaleMessageA {param} template, or plural forms keyed by Intl.PluralRules category.ListboxMatchRangeA [start, end) range of the label matched by the search text.ListboxPartPart names of classNames / styles.ListboxPropsListboxSearchOperatorBuilt-in search operators, or a predicate over the item and the search text.ListboxValueChangeReasonWhy the value changed.