Draft. Ported from control-center’s Command (commit
534414f, itself from shadcn-vue) and styled with Beehexa tokens. Not yet approved. It is in the registry so teams can try it; the API may still change before approval.
Command is a search field over a list. As people type, the list keeps only the items that contain what they typed. Enter runs the highlighted item.
When to use
- As a command palette (Ctrl + K) to jump to pages and run actions without the mouse.
- For a long list of actions or places that people find faster by name than by scanning.
When not to use
- To pick a value for a form field. Use a select or a combobox.
- For a handful of actions. Use a dropdown menu.
- For searching records, such as orders by customer. That needs a search page with results.
Anatomy
| Part | Notes |
|---|---|
Command |
color.surface.overlay, radius.overlay, padding space.overlay. Add a color.border edge when it sits in the page. |
CommandInput |
The Beehexa field from Input group, with a search icon in color.icon.subtle. Placeholder color.text.subtlest. |
CommandList |
Scrolls after size.overlay.max-height (288 px). |
CommandGroup |
Optional heading: font.heading.xsmall, color.text.subtle. |
CommandItem |
The Dropdown menu item: 32 px, optional icon, label, optional CommandShortcut. Highlight color.surface.overlay.hover. |
CommandEmpty |
Shown when nothing matches: font.body.default, color.text.subtle. |
CommandSeparator |
A color.border line between groups. |
CommandDialog |
The Dialog with Command inside, near the top of the window. |
Behaviour
- Filtering keeps items whose text contains the search, ignoring case and accents, so “hoa don” finds “Hóa đơn”.
- A group with no matching item hides. The search clears after an item runs.
- Focus stays in the search field; the arrow keys move the highlight through the list.
Content
- Start actions with a verb: “Sync orders to ERP”, “Connect an online store”.
- Group by kind: Recent, Go to, Actions.
- Make the empty message short: “Nothing matches.”
Tokens
color.surface.overlay, color.surface.overlay.hover, color.border, color.text, color.text.subtle, color.text.subtlest, color.text.disabled, color.icon, color.icon.subtle, radius.overlay, radius.control.small, size.control.default, size.icon.default, space.overlay, space.050, space.100, space.300, font.body.default, font.body.small, font.label.small.