Calendar

Web/Mobile

A date picker calendar for selecting a day, several days, or a range.

اکتبر ۲۰۲۶

Installation

pnpm dlx cubix-ui@latest add calendar

Usage

Import
import * as React from "react"
import { faIR } from "react-day-picker/locale"

import { Calendar } from "@/components/cubix/calendar"
Example
<Calendar
  mode="single"
  selected={date}
  onSelect={setDate}
  locale={faIR}
  dir="rtl"
  numerals="arabext"
  className="rounded-lg border"
/>

Composition

Calendar wraps React DayPicker and styles nav and day cells with the Cubix Button of each base. Pass locale={faIR}, dir="rtl" and numerals="arabext" for Persian labels and digits. Range corners and chevrons use logical properties and cn-rtl-flip. For the Persian Solar Hijri calendar, install @daypicker/persian and swap the DayPicker import in calendar.tsx.

Structure
Calendar
└── DayPicker (locale, dir, numerals)

Accessibility

Day cells are buttons. Arrow keys move through the grid, Enter or Space selects, and the previous/next month controls are named by DayPicker. Set timeZone on the client when the highlighted day looks one day off.

Examples

Range

Use mode="range" with numberOfMonths={2} to pick a start and end date across two months.

اکتبر ۲۰۲۶
نوامبر ۲۰۲۶

Month and year selector

Set captionLayout="dropdown" to jump months and years from the caption.

اکتبر ۲۰۲۶

Booked dates

Disable dates and mark them with modifiers for a booked look.

فوریه ۲۰۲۶

Week numbers

Use showWeekNumber to show ISO week numbers in a leading column.

اکتبر ۲۰۲۶
۴۰
۴۱
۴۲
۴۳
۴۴
۴۵

Date picker

Compose Calendar with Popover to build a date picker field.

Timezone

Pass timeZone from the client so the selected day matches the user's local timezone and hydration stays stable.

اکتبر ۲۰۲۶

در حال تشخیص منطقه زمانی...

API Reference

Note: The root renders data-slot="calendar". Calendar forwards React DayPicker props. Use the same props on Base UI, React Aria, and Radix.

Calendar

PropTypeDefaultDescription
mode"single" | "multiple" | "range""single"Selection mode for one date, several dates, or a range.
selectedDate | Date[] | DateRange-The selected date, dates, or range.
onSelect(date) => void-Called when the selection changes.
captionLayout"label" | "dropdown" | "dropdown-months" | "dropdown-years""label"Month caption as text or month/year dropdowns.
numberOfMonthsnumber1How many months to show side by side.
showWeekNumberbooleanfalseShow ISO week numbers in a leading column.
showOutsideDaysbooleantrueShow days from the previous and next months.
buttonVariant"default" | "foreground" | "secondary" | "gray" | "destructive" | "destructive-secondary" | "outline" | "ghost" | "link""ghost"Visual style of the previous and next month buttons.
localeLocale-Locale from react-day-picker/locale for weekday labels and formatting.
dir"ltr" | "rtl"-Reading direction for the grid, captions, and nav chevrons.
numerals"latn" | "arab" | "arabext" | string"latn"Numbering system for day and year digits. Use arabext for Persian digits.
timeZonestring-IANA timezone used to display and select dates. Set this on the client to avoid hydration mismatches.
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).