Utility
AI
Terminal
Installation
pnpm dlx shadcn@latest add https://termcn.dev/r/command-palette.json
Usage
import { CommandPalette } from "@/components/ui/command-palette";<CommandPalette
isOpen={true}
onClose={() => setOpen(false)}
commands={[
{ id: "save", label: "Save", onSelect: () => {} },
{ id: "quit", label: "Quit", onSelect: () => {} },
]}
/>API Reference
CommandPalette
| Prop | Type | Default |
|---|---|---|
commands | Command[] | required |
isOpen | boolean | required |
onClose | () => void | required |
placeholder | string | "Type a command..." |
maxItems | number | 8 |
Command
| Prop | Type | Default |
|---|---|---|
id | string | required |
label | string | required |
description | string | undefined |
shortcut | string | undefined |
onSelect | () => void | required |
group | string | undefined |