Calendar
A month grid for picking a date or a span of them.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
A month grid for picking a date or a span of them.
Import
import { Calendar } from "@ir/ui";Watch out
- The file puts the caption and the arrows in two different orders.
Calendar / Custom Cell Sizeruns caption-then-arrows;Calendar / Week Numbersruns arrows-then-caption. Built caption-left with the arrows together on the right — the more common of the two and the one that keeps the arrows as a pair — and raised. Calendar / Custom Day Buttonfills its Range Left and Right variants withfg/on/primary-emphasis— a foreground token used as a background. Not reproduced here: the same variants on the main Day Button use bg/primary/subtle, which is what a range's edge should be.
Props
Takes the props of the element it renders, and nothing of its own — styling is the component's business, not the caller's.
Do and don't
Say the rule near the calendar — "data is kept for 13 months".
Don't — Grey out dates and leave people guessing why.
A disabled day looks the same whether it is in the past, outside a retention window or already booked. Only words separate them.
Show two months when the span is likely to cross one.
Don't — Ask for a range in a single month view.
Most ranges cross a month boundary, and paging back and forth loses the first end of the selection from view.
Use a calendar for dates near today; use fields for anything far away.
Don't — Use a calendar to capture a birth year.
A grid is faster than typing for this month. It is much slower than typing for 1974.
Keep today's subtle fill distinct from the selected day's solid one.
Don't — Style today the same as the chosen day.
They answer different questions — where am I, and what did I pick. Merged, the calendar appears to have chosen for you.
Let the locale decide.
Don't — Hardcode Sunday or Monday as the first column.
People read the grid by shape as much as by number, and a week starting on the wrong day is misread rather than re-read.
Accessibility
- react-day-picker owns the grid semantics, the roving focus and arrow-key movement. Do not re-implement them.
- Only the chevron glyph is overridden, and it is aria-hidden — the navigation buttons take their names from react-day-picker, so changing its locale changes them.
- Disabled days keep pointer-events-none and fg/disabled but stay in the accessibility tree, which is what lets someone discover a date is unavailable rather than just failing to reach it.
Where it is drawn
Figma — structure from figma, measurements from figma.