# Command

> A palette for doing anything from the keyboard: a search field over the page, and the commands under it in groups, narrowing as you type.

| | |
|---|---|
| Kind | component |
| Contract | `review` · [command.contract.yaml](https://github.com/Runceanu/rost/blob/master/contracts/command.contract.yaml) |
| Guidance | `proposed` |
| Source | [Figma 758:10](https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=758-10) · read 2026-11-17 · frozen 2026-11-17 |
| Implemented in | nowhere yet |

## Install

It lands in `src/rost/command/`, with what it needs and its contract:

```sh
npx github:Runceanu/rost add command
```

Then import `src/rost/fonts.css` and `src/rost/tokens.css` once, at the root of the app. More on this in [Install](https://rost.build/docs/install.md).

## Props

| Prop | Type | Values | Default |
|---|---|---|---|
| `open` | boolean |  | `false` |
| `groups` | node |  |  |
| `placeholder` | string |  | `Type a command or search` |
| `empty` | string |  | `No match` |
| `label` | string |  | `Command` |

## States

`Default` · `Focus`

## Anatomy

- `root`: The browser's `<dialog>` with its own look taken away, near the top of the window rather than in its middle, so the list can grow down.
- `backdrop`: Dialog's: the page's own colour at 72%.
- `panel`: The plate, 480px wide: Dialog's fill, edge and shadow, with 16px corners.
- `search`: An `<input role="combobox">`, 56px tall, 16px in at the sides, with a 1px line under it. Paragraph type.
- `search-placeholder`: What the empty field says, in the tertiary grey.
- `list`: `role="listbox"`: the groups, 4px inside, up to 320px tall before it scrolls.
- `group-label`: A group's name, in label type and the tertiary grey, 12px in, 8px above and 4px below.
- `empty` (optional): When nothing matches: one 40px row in the tertiary grey.

## When to use

- **Everywhere from one key.** Jumping to any page or starting any task without the mouse: Go to Invoices, New client. Open it with ⌘K and say so somewhere with a **Kbd**.

## When not to use

- **The only way.** Everything in it has to be reachable another way too. It's a shortcut, not the menu.
- **Picking a value in a form.** That's a **Combobox**.

## Behaviour

It opens over the page with the focus in the search field. Typing keeps the commands whose name contains what was typed, and hides a group with nothing left. Up and Down move the green highlight across the groups, Enter runs the command and closes it, Esc closes it without running anything.

## Accessibility

- **Element**: A modal `<dialog>` named by `label`. The search is `role="combobox"` pointing at the list with `aria-activedescendant`; each group is `role="group"` named by its label, each command a ComboboxOption.
- **Keyboard**: The focus stays in the search field; the highlight moves in the list.
- **Colour**: The search text is 17:1 on the plate, the group names and the empty-list words 7:1.

## Content

Commands start with a verb or say where they go: New invoice, Go to Clients.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `command/backdrop` | `#060805` |
| `command/background` | `#171717` |
| `command/edge` | `#3a3a3a` |
| `command/empty` | `#999999` |
| `command/group-label` | `#999999` |
| `command/placeholder` | `#999999` |
| `command/search` | `#ededed` |
| `command/search-line` | `#747573` |
| `command/search-line-focus` | `#ededed` |
| `font-family/base` | `'General Sans Variable'` |
| `opacity/hard` | `0.72` |
| `shadow/floating` | `0px 16px 24px 0px rgba(0, 0, 0, 0.16)` |
| `spacing/gap/2xsmall` | `4px` |
| `spacing/gap/7xlarge` | `96px` |
| `spacing/gap/medium` | `16px` |
| `spacing/gap/none` | `0px` |
| `spacing/gap/small` | `8px` |
| `spacing/gap/small-medium` | `12px` |
| `spacing/outline/medium` | `2px` |
| `spacing/outline/small` | `1px` |
| `spacing/radius/large` | `16px` |
| `spacing/size/large` | `56px` |
| `spacing/size/medium` | `40px` |
| `typography/label/font-size` | `12px` |
| `typography/label/font-weight/regular` | `400` |
| `typography/label/letter-spacing` | `0px` |
| `typography/label/line-height` | `14px` |
| `typography/paragraph/font-size` | `14px` |
| `typography/paragraph/font-weight/regular` | `400` |
| `typography/paragraph/letter-spacing` | `0px` |
| `typography/paragraph/line-height` | `20px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `panel` | `outline-offset` | `calc(-1 * var(--spacing-outline-small))` | Composed from a token: the edge sits inside the plate. |

See it live, with every value of every variant: [rost.build/components/command/](https://rost.build/components/command/)
