Command
A command palette for searching and executing commands.
Preview
Installation
Usage
import {
Command,
CommandDialog,
CommandDialogContent,
CommandDialogTrigger,
CommandEmpty,
CommandInput,
CommandItem,
CommandList,
CommandPanel,
} from "@/components/ui/command"
import { Button } from "@/components/ui/button"const items = [
{ value: "linear", label: "Linear" },
{ value: "figma", label: "Figma" },
{ value: "slack", label: "Slack" },
]
<CommandDialog>
<CommandDialogTrigger render={<Button mode="stroke" />}>
Open Command Palette
</CommandDialogTrigger>
<CommandDialogContent>
<Command items={items}>
<CommandInput placeholder="Search..." />
<CommandPanel>
<CommandEmpty>No results found.</CommandEmpty>
<CommandList>
{(item) => (
<CommandItem key={item.value} value={item}>
{item.label}
</CommandItem>
)}
</CommandList>
</CommandPanel>
</Command>
</CommandDialogContent>
</CommandDialog>API Reference
Command
Root component wrapping autocomplete with command palette defaults: autoHighlight="always", keepHighlight={true}, open={true}.
CommandDialog
Dialog root. Alias for Dialog.Root from Base UI.
CommandDialogTrigger
Trigger button for the command dialog.
CommandDialogContent
Popup with portal, backdrop, and viewport. Wraps Dialog.Portal, Dialog.Backdrop, Dialog.Viewport, and Dialog.Popup.
CommandInput
Search input with a built-in search icon. Auto-focused by default.
CommandList
Scrollable container for command items.
CommandPanel
Styled container for command content. Useful for standalone command interfaces.
CommandEmpty
Message displayed when no results match.
CommandGroup
Groups related command items together.
CommandGroupLabel
Label for a command group.
CommandCollection
Used within groups to wrap items for rendering. Alias for Autocomplete.Collection.
CommandItem
Individual selectable command item.
CommandSeparator
Visual separator between groups.
CommandShortcut
Keyboard shortcut label rendered as <kbd>.
CommandFooter
Footer section for navigation hints.
Examples
With Groups
With Shortcuts
Standalone
Use the Command component without a dialog wrapper.