# DateField

> A date, picked from a Calendar. Select's field, showing the date, and a Calendar in a Popover under it when it's pressed.

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

## Install

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

```sh
npx github:Runceanu/rost add date-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` | slot |  |  |
| `value` | node |  |  |
| `range` | node |  |  |
| `placeholder` | string |  | `Pick a date` |
| `min` | node |  |  |
| `max` | node |  |  |
| `locale` | string |  | `en` |
| `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 button covers all of it, so a press anywhere opens the Calendar.
- `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 button.
- `field`: A `<button>` over the whole box, showing the date where Select shows its value. It opens the Popover.
- `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.

## When to use

- **A date on a form.** An invoice's date, the day a payment arrived. It sits with Inputs and Selects and looks like them.

## When not to use

- **A date typed from memory.** A birthday, or a year long ago: paging through months to get there is slow. That's an **Input**.
- **The Calendar on the page.** When choosing the day is the whole task, show the **Calendar** itself, not behind a field.

## Behaviour

It looks like Select, and uses Select's colours, so a form with both reads as one. Pressing it opens a Calendar in a Popover under it, on the picked month. Picking a day closes the Popover, puts the date in the field and the focus back on it. Esc or a click outside closes it without a change. The date is written the locale's way, like Nov 17, 2026.

With `range` it takes two dates: the first press in the Calendar is the start, the second the end, and the Popover closes then. The field shows both, with the year once when they share it.

## Accessibility

- **Element**: A `<button>` named by its `<label>`, with `aria-haspopup="dialog"` and `aria-expanded`. The Popover holds the Calendar, which has its own grid.
- **Name**: `label`. The button says the date too, so a screen reader hears both: Invoice date, Nov 17, 2026.
- **Keyboard**: Tab reaches it, Enter or Space opens it with the focus on the picked day, and the Calendar's keys work from there. Esc closes it.
- **Focus**: `focus-ring` around the field, on `:focus-visible`.
- **Error**: `error` sets `aria-invalid` and ties the help line to the button. The words say what's wrong.
- **Colour**: Select's: the edge is 4.3:1 on the dark page.

## Content

A label that names the date: Invoice date, not Date.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `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` |
| `spacing/gap/large` | `24px` |
| `spacing/gap/medium-large` | `20px` |
| `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. |

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