Command Palette
⌘K launcher with fuzzy matching, highlighted letters, groups and full keyboard control.
- Zero dependencies
- React + Tailwind
- Accessible
- Reduced-motion aware
Preview
Animated · Full motion: idle animation, physics and effects. animated (default)
Bring your own items and handle onSelect. Fuzzy scoring prefers consecutive and word-start matches. This exact component powers search on this site (press ⌘K).
Installation
$ npx shadcn@latest add https://guetix.com/r/command-palette.json
Uses the shadcn CLI. It creates components/guetix/command-palette.tsx and installs nothing else.
Usage
example.tsx
App searchDocsAdmin dashboards
Under the hood
The details that make it feel right, and that a one-line prompt usually misses:
- 01Subsequence scoring with bonuses for consecutive and word-start hits.
- 02Restores focus to where you were when it closes.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | { id; label; group?; hint?; keywords?; icon? }[] | — | Commands. |
| onSelect | (item) => void | — | Handler. |
| open / onOpenChange | boolean | — | Controlled state. |
| hotkey | string | null | "k" | Letter with ⌘/Ctrl. |
| animated | boolean | true | false = the calm “Regular” version (no idle or ambient motion). |
Accessibility
- Dialog + combobox/listbox pattern with aria-activedescendant.