Listbox
Single or multi-select list with keyboard navigation
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { Listbox } from '@dryui/ui';
</script>
<Listbox.Root>
<Listbox.Item>...</Listbox.Item>
</Listbox.Root>Import options
Root package
import { Listbox } from '@dryui/ui'Per-component subpath
import { Listbox } from '@dryui/ui/listbox'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Single Selection
Selected: apple
<script lang="ts">
let selected = $state('apple');
</script>
<Listbox.Root bind:value={selected}>
<Listbox.Item value="apple">Apple</Listbox.Item>
<Listbox.Item value="banana">Banana</Listbox.Item>
<Listbox.Item value="cherry">Cherry</Listbox.Item>
<Listbox.Item value="grape" disabled>Grape (sold out)</Listbox.Item>
</Listbox.Root>Multiple Selection
Selected: apple, banana
<script lang="ts">
let selected = $state(['apple', 'banana']);
</script>
<Listbox.Root bind:value={selected} multiple>
<Listbox.Item value="apple">Apple</Listbox.Item>
<Listbox.Item value="banana">Banana</Listbox.Item>
<Listbox.Item value="cherry">Cherry</Listbox.Item>
</Listbox.Root>Structure
Compound components always start with Listbox.Root. Use this structure block to understand required wrappers before you wire state or styling.
Listbox.Root Listbox.Item
Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
Compound component. Start with Listbox.Root, then add only the parts you need.
Listbox.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
value | string | string[] | '' | — | ✓ |
multiple | boolean | false | — | — |
disabled | boolean | — | — | — |
onvaluechange | (value: string | string[]) => void | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Listbox.Item
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
value | string | — | ✓ | — |
disabled | boolean | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.