Calendar
"use client";
import { useState } from "react";
import { Calendar } from "@cherry-design-system/react";
export function DueDate() {
const [date, setDate] = useState<Date | null>(new Date());
return <Calendar locale="en-US" value={date} onChange={setDate} fullWidth />;
}An inline month grid (role="grid") for picking a single date or a range. Changing month slides the grid. Use it when the calendar should stay on the page, such as a booking sidebar. Use DatePicker for a compact form field that opens a calendar in a popover.
Examples
Range selection
With mode="range", value, defaultValue and onChange use a DateRange: { start: Date; end: Date | null }. end is null while the second end is still being picked.
"use client";
import { useState } from "react";
import { Calendar, type DateRange } from "@cherry-design-system/react";
export function Stay() {
const [range, setRange] = useState<DateRange | null>(null);
return <Calendar mode="range" value={range} onChange={setRange} locale="en-GB" />;
}Limits and disabled days
"use client";
import { Calendar } from "@cherry-design-system/react";
const today = new Date();
const inThreeMonths = new Date(today.getFullYear(), today.getMonth() + 3, today.getDate());
const isWeekend = (date: Date) => date.getDay() === 0 || date.getDay() === 6;
export function Appointment() {
return <Calendar min={today} max={inThreeMonths} isDateDisabled={isWeekend} />;
}Week start and translated labels
weekStartsOn takes 0 (Sunday) to 6 (Saturday) and defaults to the locale's first day.
"use client";
import { Calendar } from "@cherry-design-system/react";
export function Calendario() {
return (
<Calendar
locale="es-ES"
weekStartsOn={1}
labels={{ previousMonth: "Mes anterior", nextMonth: "Mes siguiente" }}
/>
);
}Controlled month
"use client";
import { useState } from "react";
import { Calendar } from "@cherry-design-system/react";
export function MonthView() {
const [month, setMonth] = useState(new Date(2026, 0, 1));
return <Calendar month={month} onMonthChange={setMonth} />;
}Properties
Single date or range selection. Defaults to "single".
Controlled selection.
Initial selection when uncontrolled.
Called with the picked date, or the range when mode="range".
Visible month (controlled). Any day inside the month works.
Initial visible month (uncontrolled). Defaults to the selection or today.
Called when the visible month changes.
Earliest selectable day.
Latest selectable day.
Extra rule for unavailable days (weekends, booked dates).
BCP 47 locale for month and weekday names. Defaults to the runtime's.
0 = Sunday to 6 = Saturday (Weekday). Defaults to the locale's first day.
Override "today" (tests, server rendering in another time zone).
Button labels (CalendarLabels). Default to "Previous month" and "Next month".
Fill the container: the seven day columns share its width.
Renders a <div>, forwards its ref and passes through native <div> attributes (except onChange and defaultValue).
Styling
Root class cherry-calendar with data-mode (single, range) and data-full-width. The month viewport uses data-direction (next, prev) while sliding. Day cells use data-range (start, middle, end) and the states data-outside, data-today, data-selected, data-preview, aria-selected, aria-current and aria-disabled. Parts: cherry-calendar__header, __nav, __title, __title-text, __grid, __weekdays, __weekday, __viewport, __weeks, __week, __cell, __day.
Reads --cherry-primary-default and --cherry-primary-fg for selected days, --cherry-secondary-hover for hover on the range strip, --cherry-accent-default for the today dot, and --cherry-ring.
Accessibility
role="grid" with one tab stop. Arrows move by day and week, PageUp and PageDown by month (Shift for a year), Home and End to the week's start and end. Today is aria-current="date" and month changes are announced.