Command

Searchable command palette with grouped items. Can be used inline or inside a dialog overlay.

Example

Props

Command.Root

PropTypeDefaultDescription
classstringAdditional CSS classes
childrenSnippetCommand content

Command.Dialog

PropTypeDefaultDescription
openbooleanfalseControls dialog visibility (bindable)
classstringAdditional CSS classes
childrenSnippetDialog content

Command.Input

PropTypeDefaultDescription
placeholderstring'Search...'Input placeholder text
valuestring''Search value (bindable)
classstringAdditional CSS classes

Command.List

PropTypeDefaultDescription
classstringAdditional CSS classes
childrenSnippetItems and groups

Command.Item

PropTypeDefaultDescription
valuestringSearch/match value
onSelect() => voidCallback when item is selected
disabledbooleanDisables the item
classstringAdditional CSS classes
childrenSnippetItem content

Command.Empty

PropTypeDefaultDescription
classstringAdditional CSS classes
childrenSnippetMessage when no results match

Command.Group / Command.GroupHeading / Command.Separator

PropTypeDefaultDescription
classstringAdditional CSS classes
childrenSnippetContent (Separator has no children)

Usage

<script>
  import { Command, Button } from '@chrissnell/chonky-ui';

  let open = $state(false);
</script>

<Button onclick={() => (open = true)}>Open Command Palette</Button>
<Command.Dialog bind:open>
  <Command.Input placeholder="Type a command..." />
  <Command.List>
    <Command.Empty>No results found.</Command.Empty>
    <Command.Group>
      <Command.GroupHeading>Files</Command.GroupHeading>
      <Command.Item value="new-file" onSelect={() => (open = false)}>
        New File
      </Command.Item>
    </Command.Group>
  </Command.List>
</Command.Dialog>