@objectifthunes/whiteboard
DATES

Calendar

A month grid with full keyboard navigation. Presentational: it paints days and reports clicks.


PREVIEW
August 2026
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
Selected

Aug 20, 2026

Constraints

10 days back to 45 days ahead, weekends disabled. Try the arrow keys, Page Up and Page Down, then Home and End.

SOURCE
import { Calendar, addDays } from '@objectifthunes/whiteboard'

<Calendar
  selected={date}
  onSelectDate={setDate}
  min={addDays(new Date(), -10)}
  max={addDays(new Date(), 45)}
  isDateDisabled={d => d.getDay() === 0 || d.getDay() === 6}
  weekStartsOn={1}
  locale="en-IE"
/>

{/* range painting is driven from outside — see DateRangePicker */}
<Calendar onSelectDate={onDay} rangeStart={start} rangeEnd={end} />
NOTES

Presentational and single-purpose: it paints days and reports clicks, and holds no opinion about what a selection means. That is why range selection lives in DateRangePicker rather than here — this component just accepts rangeStart and rangeEnd and shades the band. One grid serves single dates, ranges and multi-select without growing modes.

Keyboard: arrows move by a day, Page Up and Page Down by a month, Home and End jump to the ends of the week, Enter or Space selects. The grid has exactly one tab stop, so Tab moves past the calendar rather than through 42 cells.

Always six week rows, even when five would do, so the grid keeps one height and the calendar does not jump as you page through months. Month and weekday names come from Intl, so they follow locale with no hardcoded English list.

"Today" is drawn as an underline rather than a fill, so today and selected can both be visible on the same day. Pass today to override it, which is what makes this demo and its screenshots stable.