codefast/ui

Command Palette

Search for a command to run...

Form

Calendar

Full calendar built on @daypicker/react. Supports single, multiple, and range selection.

Install

pnpm add @codefast/ui

Import path

@codefast/ui/calendar

Examples

Date range

mode="range" over two months, with the picked span shown below.

January 2026
February 2026

Basic

A basic calendar component. We used className='rounded-lg border' to style the calendar.

June 2026

Booked dates

A calendar component that allows users to select a date or a range of dates.

February 2026

Month and Year Selector

Use captionLayout='dropdown' to show month and year dropdowns.

June 2026

Custom Cell Size

A calendar component that allows users to select a date or a range of dates.

December 2026

Multiple

Use mode=multiple to allow selecting multiple dates.

June 2026

Presets

A calendar component that allows users to select a date or a range of dates.

June 2026

RTL

Right-to-left layout support for languages such as Arabic and Hebrew.

Translations are AI-generated for demonstration and may be imperfect.

يونيو 2026

Date and Time Picker

A calendar component that allows users to select a date or a range of dates.

June 2026

Week Numbers

Use showWeekNumber to show week numbers.

February 2026
06
07
08
09

Persian / Hijri / Jalali Calendar

A Persian (Jalali) calendar built with a date-fns-jalali DateLib and Eastern Arabic numerals.

Translations are AI-generated for demonstration and may be imperfect.

خرداد ۱۴۰۴

Anatomy

How the parts compose. Copy this skeleton and fill in the slots.

import { Calendar } from "@codefast/ui/calendar";

<Calendar
  mode="single"          // "single" | "range" | "multiple"
  selected={date}
  onSelect={setDate}
/>

API reference

Props for each part of the component. All native element props are also forwarded.

Calendar

Wraps @daypicker/react; every DayPicker prop is forwarded.

PropTypeDefaultDescription
mode"single" | "range" | "multiple""single"How many dates can be selected. Changes the selected/onSelect shape.
selectedDate | DateRange | Date[]Controlled selection — type depends on mode.
onSelect(value) => voidFires with the new selection.
numberOfMonthsnumber1How many months to render side by side.
disabledMatcher | Matcher[]Disable days (e.g. past dates, weekends).

Accessibility

Built to be keyboard-navigable and screen-reader friendly out of the box.

KeyFunction
Arrow+RightMoves to the next day.
Arrow+LeftMoves to the previous day.
Arrow+DownMoves to the same weekday next week.
EnterSelects the focused day.
Page UpJumps to the previous month.
  • Built on @daypicker/react, which implements the WAI-ARIA grid pattern.
  • Pair with a readout or input so the selection isn’t conveyed only by colour.
  • For a popover date field, mount Calendar inside a Popover with a trigger button.

Guidelines

Conventions that keep usage consistent across an app.

Do

  • Show the selected date(s) in text near the calendar.
  • Disable invalid ranges (e.g. past dates for a booking).

Don’t

  • Don’t use a calendar for far-future or distant-past dates — an input is faster.
  • Don’t hide which dates are selectable.