# NumberField

> A number you nudge: minus, the value, plus, in a 48px box with Input's colours. For counts and quantities, not for prices.

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

## Install

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

```sh
npx github:Runceanu/rost add number-field
```

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` | string |  |  |
| `value` | number |  |  |
| `min` | number |  |  |
| `max` | number |  |  |
| `step` | number |  | `1` |

## States

`Default` · `Hover` · `Focus` · `Disabled` · `DecrementHover` · `IncrementHover` · `DecrementOff` · `IncrementOff`

## Anatomy

- `root`: The box: 48px tall, 4px in all round, so the two 40px buttons sit inside its 12px corners. The edge is drawn inside.
- `decrement`: Minus, a 40px button with 8px corners. Out of the Tab order: the arrow keys do the same from the field.
- `decrement-glyph`: Rost's minus icon, 20px.
- `input`: The real `<input>`, the number in the middle, paragraph type at medium weight, with figures that keep their width as the number changes.
- `increment`: Plus, the same button as minus.
- `increment-glyph`: Rost's plus icon, 20px.
- `focus-ring`: Input's ring, 4px outside the box.

## When to use

- **Small counts.** Seats on a plan, copies to print, nights in a stay: whole numbers people change by one or two.

## When not to use

- **Money and long numbers.** A price, an IBAN, a phone number: nobody nudges those by one. That's an **Input**.
- **A rough amount.** When near enough is fine and the range is wide, a **Slider** is quicker.

## Behaviour

Minus and plus move it by `step`, and switch off at `min` and `max`. You can type into it too: when you leave the field, what you typed is read as a number and kept inside `min` and `max`, and anything that isn't a number puts the last good value back.

## Accessibility

- **Element**: The input is `role="spinbutton"` with `aria-valuenow`, `aria-valuemin` and `aria-valuemax`, the ARIA pattern for a number you step through. Minus and plus are `<button>`s with `tabindex="-1"`, since the keys below do what they do.
- **Name**: `label`, as `aria-label` on the input. The buttons say Decrease and Increase.
- **Keyboard**: Up and Down step by one `step`, Page Up and Page Down by ten, Home and End go to `min` and `max` when there are any.
- **Focus**: `focus-ring` around the box, on `:focus-visible`.
- **Colour**: Input's: the edge is 4.3:1 on the dark page, the number 11:1.

## Content

Whole numbers. Put the unit in the label (Nights), not in the field.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `font-family/base` | `'General Sans Variable'` |
| `number-field/background` | `#060805` |
| `number-field/disabled/background` | `#171717` |
| `number-field/disabled/edge` | `#3a3a3a` |
| `number-field/disabled/step` | `#b6ffda` |
| `number-field/disabled/value` | `#555555` |
| `number-field/edge` | `#747573` |
| `number-field/focus-ring` | `#00d669` |
| `number-field/hover/background` | `#171717` |
| `number-field/hover/edge` | `#999999` |
| `number-field/step` | `#00d669` |
| `number-field/step-hover/background` | `#006f27` |
| `number-field/value` | `#c2c7c3` |
| `opacity/soft` | `0.16` |
| `spacing/gap/2xsmall` | `4px` |
| `spacing/outline/medium` | `2px` |
| `spacing/outline/small` | `1px` |
| `spacing/radius/large` | `16px` |
| `spacing/radius/medium` | `12px` |
| `spacing/radius/small` | `8px` |
| `spacing/size/medium` | `40px` |
| `spacing/size/medium-large` | `48px` |
| `spacing/size/xsmall` | `20px` |
| `typography/paragraph/font-size` | `14px` |
| `typography/paragraph/font-weight/medium` | `500` |
| `typography/paragraph/letter-spacing` | `0px` |
| `typography/paragraph/line-height` | `20px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `root` | `outline-offset` | `calc(-1 * var(--spacing-outline-small))` | Composed from a token: the edge sits inside the box. |
| `decrement-glyph` | `mask` | `url(./icon-minus.svg) center / contain no-repeat` | The icon file itself. |
| `increment-glyph` | `mask` | `url(./icon-plus.svg) center / contain no-repeat` | The icon file itself. |
| `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/number-field/](https://rost.build/components/number-field/)
