October 2026
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Installation
npx logic2b@next add calendarUsage
import { useState } from "react"
import { Calendar } from "@/components/ui/calendar"
const [date, setDate] = useState<Date | undefined>(new Date())
<Calendar mode="single" selected={date} onSelect={setDate} className="rounded-md border" />
Built on react-day-picker. See also date picker for a composition with popover that turns the calendar into a text-input-style field.
Usage notes
All other react-day-picker DayPicker props are forwarded.
Examples
Range
Set mode="range" and hold a DateRange in state to pick a start and end day.
October 2026
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
November 2026
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Dropdown caption
Use captionLayout="dropdown" to switch months and years with select menus.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Calendar
mode="single"
defaultMonth={new Date(2026, 7, 15)}
today={new Date(2026, 7, 15)}
selected={new Date(2026, 7, 15)}
showOutsideDays
captionLayout="label"
aria-label="August 2026 release calendar"
/>August 2026
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
API reference
Generated from the public TypeScript exports in src/ui/calendar.tsx.
Calendar
ComponentProps: React.ComponentProps<typeof DayPicker> & { buttonVariant?: React.ComponentProps<typeof Button>["variant"] }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
showOutsideDays | boolean | No | true | Show the outside days (days falling in the next or the previous month). **Note:** when a {@link broadcastCalendar} is set, this prop defaults to true. |
captionLayout | "label" | "dropdown" | "dropdown-months" | "dropdown-years" | No | "label" | Show dropdowns to navigate between months or years. - `label`: Displays the month and year as a label. Default value. - `dropdown`: Displays dropdowns for both month and year navigation. - `dropdown-months`: Displays a dropdown only for the month navigation. - `dropdown-years`: Displays a dropdown only for the year navigation. **Note:** By default, showing the dropdown will set the {@link startMonth} to 100 years ago and {@link endMonth} to the end of the current year. You can override this behavior by explicitly setting `startMonth` and `endMonth`. |
buttonVariant | React.ComponentProps<typeof Button>["variant"] | No | "ghost" | — |
CalendarDayButton
ComponentProps: React.ComponentProps<typeof DayButton>Accessibility contract
Machine-readable behavior and consumer responsibilities for calendar.
- Support
- Primitive-managed
- Pattern
- date grid
- React DayPicker
| Keys | Behavior |
|---|---|
| ArrowUp ArrowDown ArrowLeft ArrowRight | Move within the composite control. |
| PageUp PageDown | Move between months. |
| Home End | Move within the current week. |
| Enter Space | Select the focused date. |
Built-in semantics
- Uses grid/gridcell semantics with labelled navigation and selected/disabled date state.
Consumer responsibilities
- Provide a label describing the date purpose and expose format/validation guidance near related inputs.