CommandPalette
UnderstoryUsage
The import, then a use to start from. Both copy as they are.
Import
import { usePublishPaletteCommands } from "@/components/command-palette/CommandPaletteProvider";import { Plus } from "@/components/icons";Example
usePublishPaletteCommands([ { id: "action:new-site", group: "actions", label: "Create a docs site", icon: <Plus />, href: "/get-started" }]);When to use
Use it for
- ⌘K navigation, search and the way into the agent. The app shell mounts it once.
- A feature adds its commands with
usePublishPaletteCommands. The sidebar already publishes its sections and docs sites. - Actions are labelled with a verb (“Create a docs site”); places with their name (“Members”).
Avoid
- A second search box for the same things.
- Commands for what the person can't do. Hide them, as the sidebar does.
Accessibility
Checks
- It opens with ⌘K or Ctrl+K and from its header button; the arrow keys move, Enter runs, Escape closes.
API
Read from each component's stories, the same source as COMPONENTS.md, and kept in step by check:design-system.
CommandPalette
The ⌘K command palette. The sidebar publishes its sections and docs sites (so whatever hides a nav item hides its command), and the app shell adds its actions. ↑↓/Home/End move the highlight, ↵ runs it, and running anything closes the palette.
Its stories don't declareargTypes, so no props are listed. The variants show its states.Also exportsCommandPaletteDialog
VariantsOpenFilteredAgentAfterMatchesEmptyRecentHeaderButton