Command Palette
Terminal-styled command palette (Ctrl+K style) with search filtering.
Import
import { CommandPalette } from "neoterm-ui";Usage
const [open, setOpen] = useState(false);
<CommandPalette
open={open}
onClose={() => setOpen(false)}
placeholder="Type a command…"
items={[
{ id: "1", label: "Go to Dashboard", shortcut: "⌘D", group: "Navigation", onSelect: () => {} },
{ id: "2", label: "Toggle Dark Mode", shortcut: "⌘T", group: "Settings", onSelect: () => {} },
{ id: "3", label: "Search Logs", group: "Tools", onSelect: () => {} },
]}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | — | Palette visibility. |
| onClose | () => void | — | Close callback. |
| items | CommandItem[] | — | Array of command items. |
| placeholder | string | — | Search input placeholder. |
CommandItem
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | — | Unique identifier. |
| label | string | — | Command label. |
| shortcut | string | — | Keyboard shortcut hint. |
| icon | ReactNode | — | Leading icon. |
| group | string | — | Group heading. |
| onSelect | () => void | — | Selection handler. |