# Checkbox

> A choice that's on or off and waits for the form. A 20px box that fills green with a tick, and the words beside it.

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

## Install

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

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

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 |
|---|---|---|---|
| `checked` | boolean |  | `false` |
| `indeterminate` | boolean |  | `false` |
| `children` | slot |  |  |

## States

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

## Anatomy

- `root`: A `<label>` around the input, the box and the words, so a press anywhere on it counts. Hover and press come from the label.
- `input`: The real `<input type="checkbox">`, there for the keyboard, forms and screen readers, and hidden from sight. The box draws what it says.
- `box`: The 20px square, the size of a small icon, with 4px corners. Empty it's the page's colour inside a field's edge. Ticked it's filled with the primary green.
- `check`: The tick, drawn with `icon-check.svg` as a mask in the colour of a primary button's label, 2px in from the box's edge.
- `focus-ring`: Around the box, keeping its shape.
- `label`: The words. Paragraph type, in the colour SwitchField's label has. It doesn't change when it's ticked: the box says that.

## When to use

- **Choices that wait for Save.** Settings in a form that only count when it's sent: what goes on an invoice, which months to include.
- **Agreeing to something.** One box before a button, like "I've checked these figures".

## When not to use

- **A setting that works at once.** If it changes something the moment you flip it, that's **Switch**.
- **One choice out of several.** When picking one rules out the others, that's **Radio**.

## Behaviour

Empty is a field's edge around the page colour. Ticked fills with the primary green, with a dark tick, the way a primary button looks. Hover, press and focus come from the browser. Disabled fades the whole row, words too.

Half-ticked (`indeterminate`) is the ticked look with a dash, for a box that stands for a group where only some are ticked, like a table's "select all".

## Accessibility

- **Element**: A real `<input type="checkbox">` inside a `<label>`. The input is hidden from sight, not from screen readers.
- **Name**: The words beside it, through the label. Without words, give it an `aria-label`.
- **Keyboard**: Tab reaches it. Space ticks and unticks it.
- **Focus**: `focus-ring` around the box, on `:focus-visible`.
- **Colour**: Ticked isn't only green: the tick is there too. The empty box's edge is 4.3:1 on the dark page. Ticked, the edge is the fill's green in dark and a dark green in light, so the box stands out at 3:1 or more on both.

## Content

Say what's true when it's ticked, in sentence case: "Include VAT", not "VAT: yes/no".

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `checkbox/label` | `#d3d9d5` |
| `checkbox/off/default/box` | `#060805` |
| `checkbox/off/default/edge` | `#747573` |
| `checkbox/off/disabled/box` | `#060805` |
| `checkbox/off/disabled/edge` | `#747573` |
| `checkbox/off/focus/box` | `#060805` |
| `checkbox/off/focus/edge` | `#747573` |
| `checkbox/off/focus/focus-ring` | `#999` |
| `checkbox/off/hover/box` | `#171717` |
| `checkbox/off/hover/edge` | `#999999` |
| `checkbox/off/pressed/box` | `#171717` |
| `checkbox/off/pressed/edge` | `#999999` |
| `checkbox/on/default/box` | `#00d669` |
| `checkbox/on/default/check` | `#060805` |
| `checkbox/on/disabled/box` | `#00d669` |
| `checkbox/on/disabled/check` | `#060805` |
| `checkbox/on/edge` | `#00d669` |
| `checkbox/on/focus/box` | `#00d669` |
| `checkbox/on/focus/check` | `#060805` |
| `checkbox/on/focus/focus-ring` | `#b6ffda` |
| `checkbox/on/hover/box` | `#00b450` |
| `checkbox/on/hover/check` | `#060805` |
| `checkbox/on/pressed/box` | `#00913a` |
| `checkbox/on/pressed/check` | `#060805` |
| `font-family/base` | `'General Sans Variable'` |
| `opacity/gentle` | `0.24` |
| `spacing/gap/3xsmall` | `2px` |
| `spacing/gap/small` | `8px` |
| `spacing/outline/medium` | `2px` |
| `spacing/outline/small` | `1px` |
| `spacing/radius/small` | `8px` |
| `spacing/radius/xsmall` | `4px` |
| `spacing/size/xsmall` | `20px` |
| `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 |
|---|---|---|---|
| `box` | `outline-offset` | `calc(-1 * var(--spacing-outline-small))` | Composed from a token: the edge sits inside the box. |
| `focus-ring` | `inset` | `calc(-1 * var(--spacing-gap-2xsmall))` | Composed from a token: the ring sits spacing/gap/2xsmall outside the box. |

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