uimaxxer

Command palette

⌘K opens it. Fuzzy search lights the letters you matched, Enter on an item with a page slides in the next step, and the panel's height follows what is left. Drag a step to the right to go back.

npx shadcn@latest add @uimaxxer/command-palette
Pro
PasskeysFix the duplicate Stripe charge

Nothing run yet

Usage

import { CommandPalette } from "@/components/ui/command-palette"

<CommandPalette
  groups={[{ heading: "Runs", items: [
    { id: "start", label: "Start a new run", icon: "play", shortcut: ["⌘", "N"], onSelect: start },
    { id: "assign", label: "Assign to agent…", page: { title: "Assign", groups: agents } },
  ] }]}
/>

Props

PropTypeDefaultWhat it does
groupsCommandGroup[]{ heading, items }. Items: id, label, icon or mark, hint, shortcut, keywords, onSelect, page.
item.pageCommandPage{ title, placeholder, groups }. Enter opens it; Backspace on an empty field goes back.
openbooleanControlled open state. Pair with onOpenChange.
hotkeybooleantrueToggle on ⌘K or Ctrl+K.
placeholderstring"Search or run a command"Field placeholder on the first page.
closeOnSelectbooleantrueClose after an item runs.
fuzzy(query, text)functionThe matcher, exported: returns { score, hits } or null.

Keyboard

⌘K
Open or close
↑ ↓
Move
Enter
Run, or open the item's page
Backspace
Back a page when the field is empty
Esc
Back a page, then close

Accessibility

  • A modal dialog with a combobox and listbox; the active row is aria-activedescendant, so focus never leaves the field.
  • Focus returns to whatever was focused before it opened.
  • Rows are options with aria-selected; group headings are presentational.