Skip to content
UI

Search docs

Search components and documentation

New
Menu

Calendar

A date field with a calendar grid for picking a single day, multiple days or a date range.

July 2026

Installation

npx logic2b@latest add calendar

Usage

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.

API

Prop Type Default
mode single | multiple | range
selected / onSelect depends on mode
captionLayout label | dropdown | dropdown-months | dropdown-years label
buttonVariant button variant for the nav buttons ghost
showOutsideDays boolean true
numberOfMonths number — months to render side by side 1

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.

July 2026
August 2026

Use captionLayout="dropdown" to switch months and years with select menus.

July 2026