CommandPalette
Searchable command menu dialog
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 { CommandPalette } from '@dryui/ui';
</script>
<CommandPalette.Root>
<CommandPalette.Input>...</CommandPalette.Input>
<CommandPalette.List>...</CommandPalette.List>
<CommandPalette.Group>...</CommandPalette.Group>
<CommandPalette.Item>...</CommandPalette.Item>
<CommandPalette.Empty>...</CommandPalette.Empty>
<CommandPalette.Separator>...</CommandPalette.Separator>
</CommandPalette.Root>Import options
Root package
import { CommandPalette } from '@dryui/ui'Per-component subpath
import { CommandPalette } from '@dryui/ui/command-palette'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Searchable Command Palette
<script lang="ts">
let open = $state(false);
</script>
<Button onclick={() => open = true}>Open Command Palette</Button>
<CommandPalette.Root bind:open>
<CommandPalette.Input placeholder="Type a command or search..." />
<CommandPalette.List>
<CommandPalette.Group heading="Navigation">
<CommandPalette.Item value="home" onSelect={() => open = false}>Go to Home</CommandPalette.Item>
<CommandPalette.Item value="docs" onSelect={() => open = false}>Go to Docs</CommandPalette.Item>
<CommandPalette.Item value="settings" onSelect={() => open = false}>Open Settings</CommandPalette.Item>
</CommandPalette.Group>
<CommandPalette.Separator />
<CommandPalette.Group heading="Actions">
<CommandPalette.Item value="new-file" onSelect={() => open = false}>New File</CommandPalette.Item>
<CommandPalette.Item value="save" onSelect={() => open = false}>Save</CommandPalette.Item>
</CommandPalette.Group>
<CommandPalette.Empty>No results found.</CommandPalette.Empty>
</CommandPalette.List>
</CommandPalette.Root>Structure
Compound components always start with CommandPalette.Root. Use this structure block to understand required wrappers before you wire state or styling.
CommandPalette.Root CommandPalette.Input CommandPalette.List CommandPalette.Group CommandPalette.Item CommandPalette.Empty CommandPalette.Separator
Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
Compound component. Start with CommandPalette.Root, then add only the parts you need.
CommandPalette.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
open | boolean | false | — | — |
children | Snippet | — | ✓ | — |
Forwards native HTML attributes via rest props.
CommandPalette.Input
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
placeholder | string | — | — | — |
Forwards <input> attributes via rest props. Common examples: name, autocomplete, inputmode.
CommandPalette.List
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
CommandPalette.Group
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
heading | string | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
CommandPalette.Item
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
value | string | — | ✓ | — |
disabled | boolean | — | — | — |
onSelect | () => void | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
CommandPalette.Empty
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
CommandPalette.Separator
| Prop | Type | Default | Required | Bindable |
|---|
Forwards <div> attributes via rest props. Common examples: id, style, role.