Skip to content
Logic2BUI

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.

October 2026

Installation

npx logic2b@next 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.

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
November 2026

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

October 2026

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"
 />

API reference

Generated from the public TypeScript exports in src/ui/calendar.tsx.

View JSON

Calendar

Component
Props: React.ComponentProps<typeof DayPicker> & { buttonVariant?: React.ComponentProps<typeof Button>["variant"] }
PropTypeRequiredDefaultDescription
showOutsideDaysbooleanNotrueShow 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`.
buttonVariantReact.ComponentProps<typeof Button>["variant"]No"ghost"—

CalendarDayButton

Component
Props: React.ComponentProps<typeof DayButton>

Accessibility contract

Machine-readable behavior and consumer responsibilities for calendar.

View JSON
Support
Primitive-managed
Pattern
date grid
React DayPicker
Keyboard interactions for calendar
KeysBehavior
ArrowUp ArrowDown ArrowLeft ArrowRightMove within the composite control.
PageUp PageDownMove between months.
Home EndMove within the current week.
Enter SpaceSelect 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.