Combobox
Searchable text input with filterable dropdown suggestions
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 { Combobox } from '@dryui/ui';
</script>
<Combobox.Root bind:value={selectedFramework} name="framework">
<Combobox.Input placeholder="Search frameworks..." />
<Combobox.Content>
<Combobox.Item value="svelte" index={0}>Svelte</Combobox.Item>
<Combobox.Item value="react" index={1}>React</Combobox.Item>
</Combobox.Content>
</Combobox.Root>Import options
Root package
import { Combobox } from '@dryui/ui'Per-component subpath
import { Combobox } from '@dryui/ui/combobox'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Use Combobox when users need to search or type before choosing a value. Add `name` to submit the selected option with a form.
Searchable Combobox
<script lang="ts">
let value = $state('');
const options = [
{ value: 'react', label: 'React' },
{ value: 'svelte', label: 'Svelte' },
{ value: 'vue', label: 'Vue' },
{ value: 'angular', label: 'Angular' },
{ value: 'solid', label: 'Solid' },
];
</script>
<Combobox.Root bind:value name="framework">
<Combobox.Input aria-label="Framework" placeholder="Search frameworks..." />
<Combobox.Content>
{#each options as option, i (option.value)}
<Combobox.Item value={option.value} index={i}>{option.label}</Combobox.Item>
{/each}
<Combobox.Empty>No frameworks found.</Combobox.Empty>
</Combobox.Content>
</Combobox.Root>Named Combobox
<script lang="ts">
let framework = $state('');
const options = [
{ value: 'react', label: 'React' },
{ value: 'svelte', label: 'Svelte' },
{ value: 'vue', label: 'Vue' },
];
</script>
<form>
<Combobox.Root bind:value={framework} name="framework">
<Combobox.Input aria-label="Framework" placeholder="Search frameworks..." />
<Combobox.Content>
{#each options as option, i (option.value)}
<Combobox.Item value={option.value} index={i}>{option.label}</Combobox.Item>
{/each}
</Combobox.Content>
</Combobox.Root>
</form>Structure
Compound components always start with Combobox.Root. Use this structure block to understand required wrappers before you wire state or styling.
Combobox.Root
Combobox.Input
Combobox.Content
Combobox.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 Combobox.Root, then add only the parts you need.
Combobox.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
open | boolean | false | — | ✓ |
value | string | '' | — | ✓ |
disabled | boolean | — | — | — |
name | string Adds a hidden input so the selected value participates in native form submission. | — | — | — |
children | Snippet | — | ✓ | — |
Also accepts standard HTML attributes (class, style, id, etc.)
Combobox.Input
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
placeholder | string | — | — | — |
size | smmdlg | 'md' | — | — |
Forwards <input> attributes via rest props. Common examples: name, autocomplete, inputmode. Omitted: size.
Combobox.Content
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
offset | number | — | — | — |
loading | boolean | — | — | — |
loadingContent | Snippet | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Combobox.Item
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
value | string | — | ✓ | — |
index | number | — | ✓ | — |
disabled | boolean | — | — | — |
icon | Snippet | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Combobox.Empty
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Combobox.Group
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
label | string | — | ✓ | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.