Basel Standard / Docs
Command
Search-and-jump surface for quick navigation, action lookup, and compact command palettes.
Command surfaces are for fast retrieval. They help users jump to a page, trigger a known action, or recall a label they do not want to hunt through navigation for. In this system the command palette is compact, typographic, and best used for speed, not discovery.
Installation
Purchase access, then open /account/install to issue a registry token.Usage
import {
Command,
CommandDialog,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandShortcut,
} from "@/components/ui/command"
<Command>
<CommandInput placeholder="Search docs..." />
<CommandList>
<CommandGroup heading="Pages">
<CommandItem>
Dialog
<CommandShortcut>RET</CommandShortcut>
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
Why This Primitive Exists
Global navigation, dense sidebars, and long settings pages are slow when the user already knows the destination. Command surfaces reduce that friction.
- Use
Commandinline when the search surface belongs inside the page. - Use
CommandDialogwhen the command palette should temporarily sit above the current context. - Keep results short, exact, and grouped by intent so scanning stays fast.
Examples
Inline Command Surface
The smallest useful pattern is an input followed by grouped results. Keep the first group immediately actionable.
<Command>
<CommandInput placeholder="Search commands, pages, and collections..." />
<CommandList>
<CommandGroup heading="Navigate">
<CommandItem>
Launch calendar
<CommandShortcut>G L</CommandShortcut>
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
Group Results By Intent
Separate destinations from actions. That keeps a user from confusing "go there" with "do this".
<CommandList>
<CommandGroup heading="Views">{/* destinations */}</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Actions">{/* commands */}</CommandGroup>
</CommandList>
In Context
Command should accelerate a workflow that already has structure around it. Let the page explain the task and use the palette for shortcuts.
Quick navigation
The surrounding card explains the task. The command surface handles the fast path.
<Card>
<CardHeader>{/* task context */}</CardHeader>
<CardContent>
<Command>{/* quick navigation and actions */}</Command>
</CardContent>
</Card>
Dialog Variant
Use CommandDialog when the palette should open above the page with the same visual language as the rest of the overlay system.
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandInput placeholder="Jump to a primitive..." />
<CommandList>{/* groups and items */}</CommandList>
</CommandDialog>
Guidance
Favor Retrieval Over Exploration
- Use command when users already know the label, destination, or action they want.
- Do not use it as the only navigation model for a feature that still needs visible orientation.
- If the result labels require explanation paragraphs, the palette is carrying too much.
Keep The Result Set Tight
- Group by intent such as
Views,Actions, orRecent. - Put the most likely actions first in each group.
- Keep shortcuts supportive, not required.
Choose Inline Or Dialog Deliberately
- Use inline command inside settings panels, side rails, or admin workspaces.
- Use
CommandDialogfor global jumps and cross-surface actions. - If the interaction needs forms, confirmations, or multi-step editing, move to a dialog or dedicated page instead.
API Reference
Core Exports
| Export | Renders | Notes |
|---|---|---|
Command | CommandPrimitive | Root palette container with the shared border and type treatment. |
CommandDialog | Dialog composition | Wraps Command inside the repo's dialog surface and hides the close button. |
CommandInput | CommandPrimitive.Input | Search field with the leading search icon and uppercase input styling. |
CommandList | CommandPrimitive.List | Scrollable result container. |
CommandEmpty | CommandPrimitive.Empty | Empty state row shown when no items match. |
CommandGroup | CommandPrimitive.Group | Group wrapper with heading support. |
CommandItem | CommandPrimitive.Item | Selectable result row with selected and disabled states. |
CommandShortcut | span | Utility slot for compact keyboard hints. |
CommandSeparator | CommandPrimitive.Separator | Divider between groups. |
Notable Props
| Export | Prop | Type | Notes |
|---|---|---|---|
CommandDialog | open, defaultOpen, onOpenChange | DialogProps | Uses the same controlled and uncontrolled API as the shared dialog wrapper. |
CommandInput | placeholder, value, onValueChange | cmdk input props | Supports the standard cmdk filtering model. |
CommandItem | value, keywords, onSelect, disabled | cmdk item props | Use value and keywords to improve retrieval quality. |
Command | className, filter, shouldFilter | cmdk root props | Exposes the underlying cmdk root behavior. |
The command implementation is a Swiss wrapper around cmdk, so the underlying accessibility and keyboard behavior remain available.