- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
Groups
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
Fruits
Vegetables
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
Fruits
Vegetables
Multiple
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
Disabled
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
Disabled Item
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
Search
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
Direction
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
- Apple
- Banana
- Orange
- Carrot
- Broccoli
- Spinach
API Reference
Root
| Property | Default | Type |
|---|---|---|
orientation | "vertical" | "horizontal" | "vertical" | undefinedThe orientation of the listbox. |
collection | - | ListCollection<any> | GridCollection<any>The item collection |
ids | - | Partial<{ root: string; content: string; label: string; item: (id: string | number) => string; itemGroup: (id: string | number) => string; itemGroupLabel: (id: string | number) => string; }> | undefined The ids of the elements in the listbox. Useful for composition. |
disabled | - | boolean | undefinedWhether the listbox is disabled |
disallowSelectAll | - | boolean | undefinedWhether to disallow selecting all items when `meta+a` is pressed |
onHighlightChange | - | ((details: HighlightChangeDetails<any>) => void) | undefinedThe callback fired when the highlighted item changes. |
onValueChange | - | ((details: ValueChangeDetails<any>) => void) | undefinedThe callback fired when the selected item changes. |
value | - | string[] | undefinedThe controlled keys of the selected items |
defaultValue | [] | string[] | undefinedThe initial default value of the listbox when rendered. Use when you don't need to control the value of the listbox. |
highlightedValue | - | string | null | undefinedThe controlled key of the highlighted item |
defaultHighlightedValue | - | string | null | undefinedThe initial value of the highlighted item when opened. Use when you don't need to control the highlighted value of the listbox. |
loopFocus | false | boolean | undefinedWhether to loop the keyboard navigation through the options |
selectionMode | "single" | SelectionMode | undefinedHow multiple selection should behave in the listbox. - `single`: The user can select a single item. - `multiple`: The user can select multiple items without using modifier keys. - `extended`: The user can select multiple items by using modifier keys. |
scrollToIndexFn | - | ((details: ScrollToIndexDetails) => void) | undefinedFunction to scroll to a specific index |
selectOnHighlight | - | boolean | undefinedWhether to select the item when it is highlighted |
deselectable | - | boolean | undefinedWhether to disallow empty selection |
typeahead | - | boolean | undefinedWhether to enable typeahead on the listbox |
onSelect | - | ((details: SelectionDetails) => void) | undefinedFunction called when an item is selected |
dir | "ltr" | "ltr" | "rtl" | undefinedThe document's text/writing direction. |
getRootNode | - | (() => ShadowRoot | Node | Document) | undefinedA root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
RootProvider
| Property | Default | Type |
|---|---|---|
value | - | () => ListboxApi<PropTypes, any> |
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
RootContext
| Property | Default | Type |
|---|---|---|
children | - | Snippet<[() => ListboxApi<PropTypes, any>]> |
Label
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"label">]> | undefinedRender the element yourself |
Input
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"input">]> | undefinedRender the element yourself |
Content
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"ul">]> | undefinedRender the element yourself |
ItemGroup
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
ItemGroupLabel
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
Item
| Property | Default | Type |
|---|---|---|
item | - | anyThe item to render |
highlightOnHover | - | boolean | undefinedWhether to highlight the item on hover |
element | - | Snippet<[HTMLAttributes<"li">]> | undefinedRender the element yourself |
ItemText
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"span">]> | undefinedRender the element yourself |
ItemIndicator
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"span">]> | undefinedRender the element yourself |