Command Palette
⌘K search over pages, docs and actions, with groups, keyboard navigation, highlighted matches and recent items. Opens as a dialog or sits inline.
Installation
Full Setup guideInstall the component automatically via Shadcn CLI.
npx shadcn@latest add https://www.grettech.com/api/registry/command-paletteProps
| Prop | Type | Default | Description |
|---|---|---|---|
groups* | CommandGroup[] | - | Results, grouped under headings. |
variant | "dialog" | "inline" | "dialog" | Opens over the page, or renders the panel in place (e.g. a docs search page). |
open | boolean | - | Controlled open state of the dialog. |
onOpenChange | (open: boolean) => void | - | Called when the dialog opens or closes. |
hotkey | string | null | "k" | Key that opens the dialog with ⌘ or Ctrl. null disables it. |
onNavigate | (href: string) => void | window.location.assign | Called for items with an href, e.g. router.push. Defaults to a full page navigation. |
placeholder | string | "Search pages and actions…" | Search placeholder, also the input's accessible name. |
emptyMessage | string | "No results." | Shown when nothing matches. |
recentKey | string | null | "gridtic-command-recent" | localStorage key for recent items. null turns recents off. |
hideTrigger | boolean | false | Hides the built-in search button; open it with the hotkey or open. |
triggerLabel | string | "Search…" | Text in the search button. |
className | string | - | Extra classes for the search button, or the panel when inline. |