◇
Listbox
7 partsAnatomy
Import the parts and compose them. Each part forwards attributes to its underlying element.
vue
import {
ListboxRoot,
ListboxContent,
ListboxItem,
ListboxItemIndicator,
ListboxGroup,
ListboxGroupLabel,
ListboxFilter,
} from '@robonen/primitives/listbox';
<ListboxRoot>
<ListboxContent />
<ListboxItem />
<ListboxItemIndicator />
<ListboxGroup />
<ListboxGroupLabel />
<ListboxFilter />
</ListboxRoot>API Reference
ListboxRoot
Root| Prop | Type | Description |
|---|---|---|
modelValue? | U | U[] | Controlled value. Use `v-model`. |
defaultValue? | U | U[] | Uncontrolled initial value. |
multiple? | boolean | Allow multiple selection. |
orientation? | ListboxOrientation | Navigation orientation. |
dir? | ListboxDirection | Reading direction. Falls back to `ConfigProvider`. |
disabled? | boolean | Disable the whole listbox. |
selectionBehavior? | ListboxSelectionBehavior | How selection behaves in `multiple` mode. |
highlightOnHover? | boolean | Highlight items on hover. |
by? | string | ((a: U, b: U) => boolean) | Compare objects by key or custom comparator. |
ListboxContent
ContentNo props or events — renders its element and forwards attributes.
ListboxItem
Item| Prop | Type | Description |
|---|---|---|
value | U | The value of the item. |
disabled? | boolean | Disable this item. |
ListboxItemIndicator
ItemIndicatorNo props or events — renders its element and forwards attributes.
ListboxGroup
GroupNo props or events — renders its element and forwards attributes.
ListboxGroupLabel
GroupLabelNo props or events — renders its element and forwards attributes.
ListboxFilter
Filter| Prop | Type | Description |
|---|---|---|
modelValue? | string | Controlled input value. |
autoFocus? | boolean | Focus on mount. |
disabled? | boolean | Disable input. |