Calendar
An accessible month calendar for selecting dates.
Overview
Calendar wraps react-day-picker with Vinyaas styling. It owns the month grid, keyboard navigation, and caption controls. Pair it with Date Picker when you need a compact trigger and popover.
Install adds react-day-picker and date-fns as dependencies.
Preview
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Customize
Installation
Add the component with the CLI. It copies the files in and installs anything they depend on.
npx vinyaas add calendarUsage
import { useState } from "react";
import { Calendar } from "@/components/ui/calendar";
export function PickDate() {
const [date, setDate] = useState<Date | undefined>();
return (
<Calendar
mode="single"
selected={date}
onSelect={setDate}
className="rounded-md border"
/>
);
}Examples
Basic
Single-date selection with controlled state.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Selected date
Open the grid on a month that includes the current value.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Selected Thu, October 15, 2026
Disabled dates
Matchers prevent choosing past days.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Month navigation
Previous/next buttons and native month/year selects. Set defaultMonth for a fixed starting view.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Use the previous/next buttons or the month and year selects to move between months. Pass defaultMonth to open on a specific month.
Multiple dates
Toggle individual dates on and off. Each click adds or removes a day.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
No dates selected
Date range
Pick a start and end date with in-range highlighting.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
3/10/2026 – 3/16/2026
In practice
Embed Calendar in a scheduling form. Disable weekends or blackout dates with matchers.
API
Other attributes for the underlying element are passed through.
| Name | Type | Default | Description |
|---|---|---|---|
mode | "single" | "multiple" | "range" | — | Selection mode forwarded to DayPicker. Use single for one date or range for a start and end. |
selected | Date | Date[] | DateRange | — | The selected date, dates, or range for the active mode. |
onSelect | (date) => void | — | Called when the user selects or clears a date or range. |
disabled | Matcher | Matcher[] | — | Dates or rules that cannot be selected (for example before today). |
defaultMonth | Date | — | Month shown on first render when no month is selected. |
showOutsideDays | boolean | true | Whether days from adjacent months appear in the grid. |
className / classNames | string / object | — | Extra classes on the root or individual DayPicker parts. |
Accessibility
DayPicker renders a semantic grid with labeled navigation buttons. Arrow keys move focus between days; Enter and Space select the focused day.
Disabled days are omitted from selection and exposed as unavailable in the grid. When Calendar sits inside a form, associate it with Label via id on the root or describe the chosen date in nearby helper text.