Command
Find and run actions in an inline list or a dialog.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/commandComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/button @siteplane/kbdUsage
import { SettingsIcon } from "lucide-react";
import {
Command,
CommandInput,
CommandPanel,
CommandList,
CommandItem,
} from "@/siteplane/components/command";
<Command items={["Settings"]}>
<CommandInput aria-label="Search" />
<CommandPanel>
<CommandList>
{(item: string) => (
<CommandItem value={item}>
<SettingsIcon />
{item}
</CommandItem>
)}
</CommandList>
</CommandPanel>
</Command>;Composition
Command
├── CommandInput
├── CommandPanel
│ ├── CommandEmpty
│ └── CommandList → CommandItem
│ or CommandGroup → CommandGroupLabel + CommandCollection → CommandItem
└── CommandFooter
CommandDialog → CommandDialogTrigger + CommandDialogPopup → CommandInline command
Command renders an open, inline list by default, so it can sit in a page or panel without a dialog. CommandShortcut only displays a hint; register the matching keyboard handler in your application.
The search row and the results follow the control size: the row is 40, 44, 48 and 60 px tall and a result 37, 41, 45 and 56 px from sm to xl. A size on CommandInput sizes only its text.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Command. | readonly ItemValue[] | — | String/object items or grouped collections. |
Command. | Autocomplete autoHighlight | always | Highlights a matching item automatically. |
Command. | boolean | true | Keeps the highlight across pointer movement. |
Command inline / open | Autocomplete root props | true / true | Inline, visible command list by default. |
Command | AutocompleteInput props | aria-label "Search commands", no placeholder | Search input; override aria-label to describe what it searches. |
Command | div props | — | Scroll/layout container. |
Command | AutocompleteList / AutocompleteEmpty props | — | Filtered render callback and empty result. |
Command | Matching Autocomplete part props | — | Grouped item rendering. |
Command | AutocompleteItem props | — | value, disabled, onClick and render. |
Command | AutocompleteSeparator props | — | Decorative division. |
Command | kbd / div props | — | Shortcut presentation and supporting instructions. |
Command | DialogPopup props | aria-label "Command palette", no close button | Dialog popup sized for a command palette. |
Command | Corresponding Dialog parts | Dialog defaults | Aliases for dialog composition. |
Command | DialogCreateHandle / DialogPrimitive | — | Detached handle and foundation namespace. |
Usage notes
Remaining root and item contracts follow Autocomplete; dialog state, focus, portals and dismissal follow Dialog. This component does not register global shortcuts, execute commands, persist history, or navigate automatically; the command palette example adds its own ⌘J/Ctrl+J handler.