Calendar

Days, months and years, written by hand.

One day

Arrow keys move a day at a time; Page Up and Page Down move a month.

September 2026
SuMoTuWeThFrSa

One day, several days, or a stretch of them. It can show more than one month at a time, offer dropdowns for month and year, and speak whatever language you hand it. There is no date library behind it — the arithmetic is ours.

Installation

npx philcn@latest add calendar

The file is written into your project. It is yours from then on — change it as you like.

Examples

A range, over two months

Pick a first day, then a last one. Two months make a long stretch easier to see.

September 2026
SuMoTuWeThFrSa
October 2026
SuMoTuWeThFrSa

Props

PropTypeWhat it does
Calendar.mode"multiple" | "range" | "single"One of `"single"`, `"multiple"` or `"range"`. It decides what `selected` holds.
Calendar.selectedDate[] | Date | DateRangeWhat is chosen: a date, an array of them, or a range.
Calendar.onSelect((date: Date | undefined) => void) | ((dates: Date[] | undefined) => void) | ((range: DateRange | undefined) => void)Called with the new choice, in the shape of the mode.
Calendar.defaultMonthDateThe month to open on, when nothing is chosen yet.
Calendar.numberOfMonthsnumberHow many months to show side by side.
Calendar.captionLayout"dropdown" | "dropdown-months" | "dropdown-years" | "label"A plain caption, or dropdowns for the month, the year, or both.
Calendar.disabledDateMatcherWhich days cannot be chosen.
Calendar.showOutsideDaysbooleanWhether the days either side of the month are drawn.
Calendar.weekStartsOnnumber0 for Sunday, 1 for Monday, and so on.

Types are read from the library itself, so this table cannot describe an option the code no longer has.

Worth knowing

  • A date picker is not a component here, any more than it is at shadcn: it is a Calendar inside a Popover.