# Calendar

> A month to pick a date from: its name between two arrows, the days of the week, and six weeks of CalendarDays. The arrow keys move a day or a week.

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

## Install

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

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

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 |
|---|---|---|---|
| `value` | node |  |  |
| `range` | node |  |  |
| `onRangeChange` | node |  |  |
| `month` | node |  |  |
| `today` | node |  |  |
| `min` | node |  |  |
| `max` | node |  |  |
| `weekStartsOn` | number |  | `1` |
| `locale` | string |  | `en` |
| `autoFocus` | boolean |  | `false` |

## Anatomy

- `root`: The header, then the grid, 8px apart. As wide as seven days.
- `header`: The month's name between two tertiary IconButtons: chevron-left and chevron-right.
- `title`: The month and year, in paragraph type, medium weight, the main text colour. It names the grid.
- `grid`: `role="grid"`: seven 40px columns. Its rows are `display: contents`, so the days line up in one grid.
- `row`: A week, or the days of the week: `role="row"`, laid out by the grid.
- `weekday`: A day of the week, two letters, in label type and the tertiary grey, centred, with 8px under.
- `cell`: `role="gridcell"` around each CalendarDay, laid out by the grid.

## When to use

- **Picking a day.** An invoice's date, the day a payment came in. Put it in a **Popover** under a date field, or on the page when choosing the date is the task.

## When not to use

- **A date someone knows by heart.** A birthday or a year far away is quicker to type. That's an **Input**.
- **A range.** From and to isn't done yet. Two Calendars, one for each end, for now.

## Behaviour

It shows six weeks, always, so it doesn't change height between months. The arrows change the month. In the grid, the arrow keys move a day or a week, Home and End to the week's ends, Page Up and Page Down a month, and Enter or Space picks. Moving past the month's edge turns the page. It calls `onValueChange` with the picked date and `onMonthChange` when the month changes. With `range` it picks two ends instead: the first press is the start, the second the end (swapped if it's earlier), and a third starts again. While only the start is picked, the days up to the one under the pointer or the focus show as the range would be.

## Accessibility

- **Element**: A grid (`role="grid"`) named by the month's title, with a header row of `columnheader`s whose names are the days in full. Only one day is in the tab order: the picked one, or today, or the first.
- **Name**: The month and year. Each day's button says its whole date.
- **Colour**: The title is 17:1 and the days of the week 7:1 on the dark page.

## Content

Let the locale name the month and the days. Monday first unless the people using it count from Sunday.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `calendar/title` | `#ededed` |
| `calendar/weekday` | `#999999` |
| `font-family/base` | `'General Sans Variable'` |
| `spacing/gap/none` | `0px` |
| `spacing/gap/small` | `8px` |
| `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/medium` | `500` |
| `typography/paragraph/letter-spacing` | `0px` |
| `typography/paragraph/line-height` | `20px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `grid` | `grid-template-columns` | `repeat(7, var(--spacing-size-medium))` | Composed from a token: seven columns, each a day wide. |

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