Calendar
Month grid on the WAI-ARIA date-grid pattern: single date or range with a hover preview, min/max and custom disabled days, months that slide in from the direction of travel. Arrows, Home/End and PageUp/PageDown (+Shift for years). Hydration-safe: today is only marked in the browser.
October 2026
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
October 2026
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
"use client";import { useState } from "react";import { Calendar, type DateRange } from "@/components/ui/calendar";const weekend = (d: Date) => d.getDay() === 0 || d.getDay() === 6;export function BookingCalendar() { const [stay, setStay] = useState<DateRange>({}); return ( <Calendar mode="range" value={stay} onValueChange={setStay} isDisabled={weekend} /> );}<Calendar>
Month grid on the WAI-ARIA date-grid pattern. Single date or range (with a hover preview), min/max and custom disabled days, months slide in from the direction of travel. Keyboard: arrows by day and week, Home/End to the week's ends, PageUp/PageDown by month (+Shift: year).
autoFocusbooleanFocus the current day on mount (DatePicker sets this).
defaultMonthDateMonth shown at first render (uncontrolled).
defaultValueDate | DateRange | nullDay or range picked at first render (uncontrolled).
isDisabled(date: Date) => booleanExtra rule, e.g. weekends off. Client-only (a function).
localestringBCP 47 locale for month and weekday names.
maxDateLatest selectable day.
minDateEarliest selectable day.
mode"single" | "range""single": pick one day. "range": pick a start, then an end.
monthDateDisplayed month (any day in it). Controlled with
onMonthChange, or start atdefaultMonth.onMonthChange(month: Date) => voidCalled when the user pages or arrows into another month.
onValueChange((date: Date) => void) | ((range: DateRange) => void)Called with the picked day, or with the range as it is picked.
valueDate | DateRange | nullControlled day, or
{ from, to }in range mode; null = nothing picked.weekStartsOn0 | 1 | 2 | 3 | 4 | 5 | 60 is Sunday, 6 is Saturday. Default 1 (Monday, ISO).
| Prop | Type | Default |
|---|---|---|
autoFocusFocus the current day on mount (DatePicker sets this). | boolean | — |
defaultMonthMonth shown at first render (uncontrolled). | Date | — |
defaultValueDay or range picked at first render (uncontrolled). | Date | DateRange | null | — |
isDisabledExtra rule, e.g. weekends off. Client-only (a function). | (date: Date) => boolean | — |
localeBCP 47 locale for month and weekday names. | string | — |
maxLatest selectable day. | Date | — |
minEarliest selectable day. | Date | — |
mode"single": pick one day. "range": pick a start, then an end. | "single" | "range" | — |
monthDisplayed month (any day in it). Controlled with | Date | — |
onMonthChangeCalled when the user pages or arrows into another month. | (month: Date) => void | — |
onValueChangeCalled with the picked day, or with the range as it is picked. | ((date: Date) => void) | ((range: DateRange) => void) | — |
valueControlled day, or | Date | DateRange | null | — |
weekStartsOn0 is Sunday, 6 is Saturday. Default 1 (Monday, ISO). | 0 | 1 | 2 | 3 | 4 | 5 | 6 | — |
key()
Local YYYY-MM-DD; sorts like the dates it names.
key(date: Date) => string
- type DateRange
- { from?: Date; to?: Date }
* required. Every component also takes className.