A clean command palette with smooth scale animations, search functionality, keyboard navigation, and customizable command groups.
Install the component using the CLI.
npx shadcn@latest add https://siddz.com/r/command-palette.jsonImport the component:
import { CommandPaletteProvider, CommandPalette, CommandPaletteSearchTrigger } from "@/components/command-palette"Use it in your code:
const groups = [
{
heading: "Navigation",
items: [
{ id: "home", label: "Go to Home", shortcut: ["G", "H"] },
{ id: "projects", label: "View Projects" },
],
},
];
<Command...| Property | Type | Default | Description |
|---|---|---|---|
groups* | array | - | Array of command groups, each with heading and items array. |
placeholder | string | "Type a command or search..." | Placeholder text for the search input. |
onSelect | function | undefined | Callback fired when a command is selected. Receives the selected item. |
emptyMessage | string | "No results found." | Message shown when no results match the search. |
className | string | "" | Additional CSS classes for the palette container. |