Command
A type-to-filter list of commands and destinations — the keyboard route to things the interface already offers somewhere visible, never the only route to them.
Inline palette
The whole grammar in one control: a filter, the list it filters, and the sentence that speaks when nothing matches. Reach for `Command` on its own when the palette IS the surface — a search page, a picker panel — and for `CommandDialog` when it interrupts one.
Usage
import {
Command,
CommandDialog,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut,
} from '@oceanic-hub/brand-system'<Command>
<CommandInput>…</CommandInput>
<CommandList>
<CommandEmpty>…</CommandEmpty>
<CommandGroup>
<CommandItem>…</CommandItem>
</CommandGroup>
</CommandList>
</Command>Composition
Use the following composition to build a Command:
Command
├── CommandInput
└── CommandList
├── CommandEmpty
├── CommandGroup ×2
│ └── CommandItem ×3
│ └── CommandShortcut
└── CommandSeparator
CommandDialog
├── CommandInput
└── CommandList
├── CommandEmpty
└── CommandGroup
└── CommandItem ×2
└── CommandShortcutIt is an accelerator, and that is the whole rule for what may live in it. A command
reachable only by typing is a command most of your readers will never find, so the palette
earns its place by being FASTER than the button, the menu and the rail — not by being the only
place a feature exists. ContextMenu's note draws the same line from the other side, and
DropdownMenu's names the mistake this one makes easy: a screen-wide command sitting on a row's
kebab, where the trigger promises it acts on that row. That command belongs here.
The filtering, the roving keyboard selection and the empty state are cmdk's, not this
package's — we own the surface it draws on and nothing about how it matches. Two consequences a
props table cannot tell you. An item's value is its IDENTITY: omit it and cmdk uses the
rendered text, so the id changes the day somebody rewrites the label or translates it. And when
the results come from a server, set shouldFilter={false} on the root — otherwise cmdk filters
the already-filtered list a second time, against the text it happens to be showing, and rows the
server matched on a field you never rendered vanish. keywords on an item is the fix for the
smaller version of that: the word people actually type ("logout") for a command that displays
another ("Sign out").
Always give CommandEmpty a real sentence. "No results" in a palette is the moment a person
most needs a hint about what they can type, and it is the only line of copy the component will
show them at their most lost.
CommandDialog is controlled-only, deliberately. There is no uncontrolled mode and no
non-modal one — a ⌘K palette that does not trap focus is a bug rather than a variant — so the
host holds the boolean and can bind the shortcut once at the top of the app. It is also a
Dialog, so everything that note says about interruption applies: opening one says stop
reading this. Its accessible name and description are visually hidden and default to a generic
pair; pass title when the palette is scoped, because "Go to project" is what somebody who
cannot see the input needs to hear instead of "Command Palette".
RTL is not supported. Upstream ships an RTL example on this page; nothing in this package has
ever been laid out or measured right-to-left, and the refusal is written down in
pairings.json under direction rather than left to be discovered.
Groups
Split the list once it is doing two jobs — acting on this page, and going somewhere else — and let CommandSeparator draw the seam between them. A heading labels a group; it never scopes the filter, which always matches across all of them and hides the groups left empty.
Shortcuts
CommandShortcut prints the keys an item already answers to elsewhere in the app — it binds nothing, so only put one here once the binding exists. A palette is where people learn the keyboard, and a key printed beside a command that ignores it teaches the opposite.
Scrollable
CommandList caps its own height and scrolls, so a palette over three hundred destinations is the same size as one over five and the input never leaves the top. Nothing to configure — this is the reason a palette beats a long menu once the list stops being countable.
In a dialog
The palette's normal home: a modal over whatever the reader was doing, opened with ⌘K and closed by the command it runs. It is controlled-only — the host holds the boolean, so the same shortcut can be bound once at the top of the app rather than per screen.
As a combobox
There is no Combobox component in this package: it is this list inside a Popover, with the trigger echoing the choice. Reach for it where Select has stopped being scannable — past a screenful of options a reader would rather type than scroll.
API Reference
See the Command API page for every prop of every part, with types, defaults and the contract that pins them.