Command Palette

View registry JSON

Search commands from a compact keyboard shortcut trigger with fuzzy matching, nested actions, and a moving result highlight.

Find a project, open a document, or run an action.

Install with the shadcn CLI

npx shadcn@4.21.5 add @cavemio/command-palette
First install? Configure @cavemio once

Run npx shadcn@4.21.5 init if shadcn is not set up, then merge this entry into the registries field in your existing components.json. Keep your other settings and registries.

components.json
{
  "registries": {
    "@cavemio": "https://registry.cavemio.dev/r/cavemio-{name}.json"
  }
}

Overview

Search commands from a compact keyboard shortcut trigger with fuzzy matching, nested actions, and a moving result highlight.

Demo commands run locally; callers supply items and navigation callbacks.

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

<CommandPalette items={[{ id: "home", label: "Home", href: "/" }]} />

Props

PropTypeDescription
itemsCommandItem[]Required. Commands and groups available in the palette.
placeholderstringOptional. Placeholder shown in the search field.
searchLabelstringOptional. Accessible name of the search field.
hotkeystringOptional. The letter that opens it with ⌘ (or Ctrl). Empty string turns the hotkey off.
openbooleanOptional. Controlled open state of the palette.
defaultOpenbooleanOptional. Initial open state when uncontrolled.
onOpenChange(open: boolean) => voidOptional. Called when the palette opens or closes.
showTriggerbooleanOptional. Show the command menu trigger. Without it, open with the hotkey or the open prop.
triggerLabelstringOptional. The pill's words.
triggerIconReact.ReactNodeOptional. Leading trigger icon. Defaults to search; pass null to omit it.
filtersCommandFilter[]Optional. Caller-owned active search scopes. The caller also filters items.
filtersLabelstringOptional. Accessible name for the active search filters.
onFilterRemove(id: string) => voidOptional. Called with the ID of a removed filter.
footerReact.ReactNodeOptional. Help copy, links, or actions alongside the keyboard hints.