Calendar

A date-grid calendar built on react-day-picker, with a calendarType prop that switches between the Jalali (Shamsi) and Gregorian (Miladi) calendars.

Last updated August 12, 2026

CreditsModifiedPublished

Copied from shadcn/ui and coss/ui.

  • Adds a calendarType prop ("shamsi" | "miladi") that switches between @daypicker/persian (faIR locale, RTL, Persian numerals) and react-day-picker (enUS locale, LTR, Latin numerals), defaulting to "shamsi"
  • Replaces pr-/pl- and rounded-l-/rounded-r- with pe-/ps- and rounded-e-/rounded-s- (logical properties) throughout

Overview

Installation

$ npx shadcn@latest add https://ui.persian-labs.ir/r/calendar.json

Usage

import { Calendar } from "@/components/ui/calendar"
 
export function Example() {
  const [date, setDate] = React.useState<Date | undefined>()
 
  return (
    <Calendar
      mode="single"
      selected={date}
      onSelect={setDate}
      className="rounded-lg border"
    />
  )
}

Examples

Calendar Type

Set calendarType to switch between the Jalali (Shamsi, the default) and Gregorian (Miladi) calendars. Shamsi renders via @daypicker/persian with the faIR locale, RTL direction, and Persian numerals; Miladi renders via react-day-picker with the enUS locale, LTR direction, and Latin numerals.

Range Calendar

Use mode="range" with a controlled selected value and onSelect. One responsive calendar handles both endpoints.

Use captionLayout="dropdown".

Presets

A calendar with a scrollable preset sidebar on desktop and a compact Drawer trigger above the month on smaller screens.

Booked Dates

Combine disabled with a booked modifier to strike through unavailable dates.

Week Numbers

Use showWeekNumber to display the ISO week number.

Holidays

Pass showHolidays to highlight Iranian holidays (red text) for the visible month, using persian-holidays internally. Hover a holiday to see its title and whether it's an official day off or just a commemorative occasion.

RTL

The Shamsi calendar (the default) is already RTL, with the faIR locale and Persian numerals. Override locale and dir directly if you need a different locale in an RTL layout.

Date Picker

Calendar is the day-grid building block. A Date Picker page, composing it with Popover for a compact single-field input (presets, range picker, reservation form), is coming soon.

API Reference

Calendar

For the complete underlying prop reference (matchers, formatters, labels), see the react-day-picker documentation.