# Combobox

> One choice from a long list, found by typing. Select's field you can type in, and the matching options in a list under it.

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

## Install

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

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

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 |
|---|---|---|---|
| `label` | slot |  |  |
| `options` | node |  |  |
| `value` | string |  |  |
| `placeholder` | string |  |  |
| `empty` | string |  | `No match` |
| `supportive` | slot |  |  |
| `error` | boolean |  | `false` |

## States

`Default` · `Hover` · `Focus` · `Disabled`

## Anatomy

- `root`: A box the size of Input, holding the parts, exactly as Select's. The input covers all of it, so a press anywhere puts the caret in it and opens the list.
- `outline`: The field's fill and its 1px edge, on their own layer, as Input has them.
- `label`: Select's label: placeholder type, 12px in from the edges. A `<label>` for the input.
- `field`: An `<input role="combobox">` over the whole box. What you type, or the picked option, sits where Select shows its value.
- `chevron`: Rost's chevron-down, 20px, drawn as a mask in Input's icon colour, 12px from the right edge.
- `supportive`: Input's help line, 4px under the field. It sits outside the field's box, so it doesn't change the field's height.
- `focus-ring`: Input's ring, 4px outside the field.
- `listbox`: `role="listbox"`, a popover under the field, 8px away and at least as wide as it. DropdownMenu's plate: 4px inside, Popover's grey, edge and shadow.
- `empty` (optional): When nothing matches: one 40px row in paragraph type and the tertiary grey.

## When to use

- **Finding one in many.** A client out of a hundred, a country, a currency: a list long enough that typing a few letters beats scrolling.

## When not to use

- **A short list.** Up to about fifteen options, a **Select** is simpler and uses the browser's own list.
- **Free text.** When any answer is fine, not just one from the list, that's an **Input**.

## Behaviour

It looks like Select and uses Select's colours. Typing opens the list and keeps the options whose name contains what was typed, ignoring case; nothing matching says so. Up and Down move the highlight, Enter picks it, Esc closes the list. Leaving the field puts the picked option's name back, so a half-typed word never looks like an answer.

## Accessibility

- **Element**: `<input role="combobox">` with `aria-expanded`, `aria-controls` and `aria-activedescendant`, the ARIA pattern for a list that filters. The list is `role="listbox"` of `role="option"`s; the picked one has `aria-selected`.
- **Name**: `label`.
- **Keyboard**: The focus stays in the input the whole time; the highlight moves in the list and screen readers follow it through `aria-activedescendant`.
- **Focus**: `focus-ring` around the field, on `:focus-visible`.
- **Error**: `error` sets `aria-invalid` and ties the help line to the input.
- **Colour**: Select's: the edge is 4.3:1 on the dark page. The empty-list words are 7:1.

## Content

Option names people would type: the client's name, not an id.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `combobox/empty` | `#999999` |
| `combobox/listbox/background` | `#171717` |
| `combobox/listbox/edge` | `#3a3a3a` |
| `font-family/base` | `'General Sans Variable'` |
| `opacity/soft` | `0.16` |
| `select/default/background` | `#060805` |
| `select/default/chevron` | `#00d669` |
| `select/default/label` | `#999999` |
| `select/default/outline` | `#747573` |
| `select/default/supportive` | `#999999` |
| `select/default/value` | `#c2c7c3` |
| `select/disabled/background` | `#171717` |
| `select/disabled/chevron` | `#b6ffda` |
| `select/disabled/label` | `#555555` |
| `select/disabled/outline` | `#3a3a3a` |
| `select/disabled/supportive` | `#555555` |
| `select/disabled/value` | `#555555` |
| `select/focus/background` | `#060805` |
| `select/focus/chevron` | `#00d669` |
| `select/focus/focus-ring` | `#00d669` |
| `select/focus/label` | `#999999` |
| `select/focus/outline` | `#747573` |
| `select/focus/supportive` | `#999999` |
| `select/focus/value` | `#c2c7c3` |
| `select/hover/background` | `#171717` |
| `select/hover/chevron` | `#00b450` |
| `select/hover/label` | `#d3d9d5` |
| `select/hover/outline` | `#999999` |
| `select/hover/supportive` | `#d3d9d5` |
| `select/hover/value` | `#d3d9d5` |
| `select/negative/default/background` | `#060805` |
| `select/negative/default/chevron` | `#e93120` |
| `select/negative/default/label` | `#e93120` |
| `select/negative/default/outline` | `#f2705f` |
| `select/negative/default/supportive` | `#e93120` |
| `select/negative/default/value` | `#999999` |
| `select/negative/focus/background` | `#060805` |
| `select/negative/focus/chevron` | `#e93120` |
| `select/negative/focus/focus-ring` | `#00d669` |
| `select/negative/focus/label` | `#e93120` |
| `select/negative/focus/outline` | `#f2705f` |
| `select/negative/focus/supportive` | `#e93120` |
| `select/negative/focus/value` | `#c2c7c3` |
| `select/negative/hover/background` | `#171717` |
| `select/negative/hover/chevron` | `#e93120` |
| `select/negative/hover/label` | `#f2705f` |
| `select/negative/hover/outline` | `#e93120` |
| `select/negative/hover/supportive` | `#e93120` |
| `select/negative/hover/value` | `#999999` |
| `shadow/floating` | `0px 16px 24px 0px rgba(0, 0, 0, 0.16)` |
| `spacing/gap/2xsmall` | `4px` |
| `spacing/gap/large` | `24px` |
| `spacing/gap/medium-large` | `20px` |
| `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/radius/medium` | `12px` |
| `spacing/size/large` | `56px` |
| `spacing/size/medium` | `40px` |
| `spacing/size/xsmall` | `20px` |
| `typography/label/font-weight/medium` | `500` |
| `typography/label/font-weight/regular` | `400` |
| `typography/paragraph/font-size` | `14px` |
| `typography/paragraph/font-weight/regular` | `400` |
| `typography/paragraph/letter-spacing` | `0px` |
| `typography/paragraph/line-height` | `20px` |
| `typography/placeholder/font-size` | `10px` |
| `typography/placeholder/letter-spacing` | `0px` |
| `typography/placeholder/line-height` | `12px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `chevron` | `mask` | `url(./icon-chevron.svg) center / contain no-repeat` | The icon file itself. |
| `supportive` | `top` | `calc(var(--spacing-size-large) + var(--spacing-gap-2xsmall))` | Composed from tokens: the field's height plus spacing/gap/2xsmall. |
| `focus-ring` | `inset` | `calc(-1 * var(--spacing-gap-2xsmall))` | Composed from a token: the ring sits spacing/gap/2xsmall outside the field. |
| `listbox` | `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/combobox/](https://rost.build/components/combobox/)
