ThiloDesign System
DV

Command

shadcn/ui

Searchable command palette. Use inline or in a dialog (Cmd+K). Foundation of Combobox.

@/components/ui/command

CommandDialog — Cmd+K palette

// Wire keyboard shortcut:
useEffect(() => {
  const down = (e: KeyboardEvent) => {
    if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
      e.preventDefault()
      setOpen((o) => !o)
    }
  }
  document.addEventListener("keydown", down)
  return () => document.removeEventListener("keydown", down)
}, [])

Inline — embedded in page

Inline: wrap in border rounded-lg. Filters in real-time via built-in cmdk filtering.

Sub-components

ComponentRole
CommandRoot container — handles filtering state
CommandDialogCommand wrapped in a Dialog for Cmd+K palettes
CommandInputSearch input — drives real-time filtering automatically
CommandListScrollable results container
CommandEmptyShown when no results match — always include
CommandGroupNamed section with a heading label
CommandItemSelectable result row — use onSelect for actions
CommandSeparatorHorizontal divider between groups
CommandShortcutRight-aligned keyboard shortcut label (⌘K)

Tokens: bg-popover text-popover-foreground — selected item: bg-accent text-accent-foreground

Command vs Combobox

CommandCombobox
PurposeGlobal actions + navigation (multi-type)Single-field value picker
OutputTriggers an action (navigate, execute)Selects a value (stored in form)
Use forCmd+K palette, advanced searchAssignee, partner, status picker in forms

On this page