Skip to content

Calendar

calendar

A month grid for a single date or a range, with no date library. Full WAI-ARIA keyboard support, month and year pickers, min, max and disabled days, a range that previews under the pointer or the keyboard, and a fixed six-week height so nothing below it jumps.

Install

$npxshadcnadd@forme/calendar

Adds the component, its registry dependencies, and the token stylesheet you import once.

When to use

Reach for it

  • Picking a date or a span by browsing: a due date, a stay, a report period. DateRangePicker wraps it in a popover with a trigger.

Use something else

  • Dates people know by heart, like a birthday: typing is faster than paging back decades.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

Calendar

A month grid for picking a date or a range.

PropTypeDefaultDescription
mode"single"—
selectedDate | DateRange—
onSelect(date: Date) => void—
defaultMonthDate—The month shown first. Defaults to the selection, or today.
weekStartsOn0 | 100 is Sunday, 1 is Monday.
minDate—
maxDate—
isDisabled(date: Date) => boolean—Return true for any date that cannot be picked: weekends, booked days.
localestring"en-US"
classNamestring—

Accessibility

  • One day is in the tab order; arrows, Home, End and Page Up/Down follow the WAI-ARIA date grid, and disabled days stay focusable and are announced as unavailable.
  • Picking a start, an end or a refused range is announced, and Escape in the month or year picker returns to the days without closing a surrounding popover.

Motion

  • Months slide 8px in the direction of travel over 150ms and leave faster on the exit curve; reduced motion keeps only the fade.
  • The range band follows the pointer on the frame: a fading band trails a moving hand.

Responsive behaviour

  • Fills its container up to 18rem; the month and year pickers take exactly the day grid's height.