Calendar

A board of date tiles. Pick one day or a range; marked days get a dot. Full keyboard support and no date library.

View as Markdown
December 2026
Mo
Tu
We
Th
Fr
Sa
Su

Picked Sunday, December 6 · dots are market days

Installation

npx shadcn@latest add @cozy/calendar

Usage

import { Calendar } from "@/components/ui/calendar"

const [day, setDay] = useState<Date>()
<Calendar mode="single" selected={day} onSelect={setDay} />

Keyboard: arrows move a day or a week, Home and End go to the week's start and end, PageUp and PageDown change the month (with Shift, the year), Enter or Space picks.

Uses the native Date in local time; bring your own date library only for formatting if you like.

Examples

Range

mode="range": the first tap sets the start, the second the end, and the band previews as you hover. Sundays are disabled here.

December 2026
Mo
Tu
We
Th
Fr
Sa
Su

4 nights at the lantern festival · closed on Sundays

Date picker

A Calendar inside a Popover, opened from an outline Button. Past days are disabled.

API

Everything else is passed through to the underlying element or Radix primitive.

PropTypeDefaultDescription
mode"single" | "range""single"One day, or a from–to range.
selectedDate | { from?: Date; to?: Date }–The picked day or range (controlled).
onSelect(value) => void–Called with the new day (or undefined when unpicked), or the new range.
disabled(day: Date) => boolean–Return true to disable a day, e.g. past days or Sundays.
markedDate[]–Days that get a small dot: events, market days, harvests.
month / defaultMonth / onMonthChangeDateselected or todayThe month shown.
weekStartsOn0 | 11Sunday or Monday.
localestringbrowserBCP 47 locale for month and weekday names, e.g. "vi-VN".