UI.MD

Calendar

A date picker calendar built on react-day-picker with UI.MD styling.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/calendar.json

Usage

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

Examples

Default

Picking one date. mode, selected, and onSelect go together, and the shape of selected follows the mode: a single Date here, a { from, to } object under range.

September 2026

Range

A start and an end date from one run of clicks. to is undefined between the first click and the second, so anything reading the range has to handle a half-finished one.

September 2026

Month and year dropdowns

captionLayout="dropdown" swaps the caption label for month and year selects. They are controls at the 32px height, so they take the action ramp (rounded-action) like a Select trigger, not the container ladder. A dropdown caption needs startMonth and endMonth to know what to list.

August 2026

API Reference

PropTypeDefaultDescription
captionLayout"label" | "dropdown" | "dropdown-months" | "dropdown-years""label"How the month caption renders. dropdown turns the month and year into selects; pair it with startMonth and endMonth to bound the lists.
mode"single" | "multiple" | "range"-Selection mode. Pair with selected and onSelect for controlled selection.
selectedDate | Date[] | DateRange | undefined-The current selection; its shape depends on mode.
onSelect(selected) => void-Called with the new selection when a day is picked.
showOutsideDaysbooleantrueShows the leading and trailing days of adjacent months in each grid.
captionLayout"label" | "dropdown" | "dropdown-months" | "dropdown-years""label"How the month caption renders: a static label or month/year dropdowns.
buttonVariant"default" | "soft" | "outline" | "ghost" | "destructive" | "subtle" | "link""ghost"Button variant used for the previous/next navigation buttons.
numberOfMonthsnumber1Number of months displayed side by side.
disabledMatcher | Matcher[]-Dates that cannot be selected, e.g. { before: new Date() }.