Select
Closed dropdown select for choosing one option from a fixed list
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 { Select } from '@dryui/ui';
</script>
<Select.Root bind:value={selected} bind:open={selectOpen} name="selection">
<Select.Trigger>
<Select.Value placeholder="Choose…" />
</Select.Trigger>
<Select.Content>
<Select.Item value="a">Alpha</Select.Item>
<Select.Item value="b">Beta</Select.Item>
</Select.Content>
</Select.Root>Import options
Root package
import { Select } from '@dryui/ui'Per-component subpath
import { Select } from '@dryui/ui/select'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Use Select for fixed options. Add `name` when you want the selected value to submit with a form. For searchable lists, use Combobox instead.
Labeled Select
Choose the role for this team member.
<div class="select-field">
<Label for="hero-role">Role</Label>
<p class="select-hint">Choose the role for this team member.</p>
<Select.Root>
<Select.Trigger>
<Select.Value placeholder="Select a role..." />
</Select.Trigger>
<Select.Content>
<Select.Item value="owner">Owner</Select.Item>
<Select.Item value="admin">Admin</Select.Item>
<Select.Item value="editor">Editor</Select.Item>
<Select.Item value="viewer">Viewer</Select.Item>
<Select.Item value="billing">Billing</Select.Item>
</Select.Content>
</Select.Root>
</div>Disabled Select
<Select.Root disabled>
<Select.Trigger>
<Select.Value placeholder="Disabled select..." />
</Select.Trigger>
<Select.Content>
<Select.Item value="a">Option A</Select.Item>
</Select.Content>
</Select.Root>Select with disabled item
<Select.Root>
<Select.Trigger>
<Select.Value placeholder="Select a plan..." />
</Select.Trigger>
<Select.Content>
<Select.Item value="free">Free</Select.Item>
<Select.Item value="pro">Pro</Select.Item>
<Select.Item value="enterprise" disabled>Enterprise (contact sales)</Select.Item>
</Select.Content>
</Select.Root>Named Select
Submitted value: none
<script lang="ts">
let fruit = $state('');
</script>
<form>
<Select.Root bind:value={fruit} name="fruit">
<Select.Trigger>
<Select.Value placeholder="Choose a fruit..." />
</Select.Trigger>
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="banana">Banana</Select.Item>
<Select.Item value="cherry">Cherry</Select.Item>
</Select.Content>
</Select.Root>
</form>Structure
Compound components always start with Select.Root. Use this structure block to understand required wrappers before you wire state or styling.
Select.Root
Select.Trigger
Select.Value
Select.Content
Select.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 Select.Root, then add only the parts you need.
Select.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.)
Select.Trigger
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Select.Content
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
offset | number | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Select.Item
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
value | string | — | ✓ | — |
disabled | boolean | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Select.Value
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
placeholder | string | — | — | — |
Forwards <span> attributes via rest props. Common examples: id, style, aria-label.