Demo
Disabled days, custom cells, month picker and calendar systems
Documented in Calendar.
Disabled days, custom cells, month picker and calendar systems
isDateDisabled for weekends and holidays, renderDay and getDayProps for marked days, a month picker through granularity, and the Buddhist and Islamic (Umm al-Qura) calendars with RTL.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||
| Jan | Feb | Mar | Apr |
| May | Jun | Jul | Aug |
| Sep | Oct | Nov | Dec |
| อา | จ | อ | พ | พฤ | ศ | ส |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | |||||
| ح | ن | ث | ر | خ | ج | س |
|---|---|---|---|---|---|---|
| ١ | ٢ | ٣ | ٤ | |||
| ٥ | ٦ | ٧ | ٨ | ٩ | ١٠ | ١١ |
| ١٢ | ١٣ | ١٤ | ١٥ | ١٦ | ١٧ | ١٨ |
| ١٩ | ٢٠ | ٢١ | ٢٢ | ٢٣ | ٢٤ | ٢٥ |
| ٢٦ | ٢٧ | ٢٨ | ٢٩ | |||
Demo.tsx
'use client';
import { Calendar, type CalendarDayContext, type PlainDate } from '@salmonui/calendars/calendar';
const HOLIDAYS = new Set(['2026-12-24', '2026-12-25', '2026-12-26', '2026-12-31']);
const PAYDAYS = new Set(['2026-12-15', '2026-12-30']);
const isWeekend = (date: PlainDate): boolean => {
const day = new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay();
return day === 0 || day === 6;
};
/** Weekends and holidays disabled with `isDateDisabled`; paydays marked through `renderDay` and `getDayProps`. */
export default function CalendarDisabledDaysDemo() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 24, alignItems: 'flex-start' }}>
<Calendar
aria-label="Working day"
locale="en-US"
defaultFocusedValue="2026-12-01"
isDateDisabled={(date) => isWeekend(date) || HOLIDAYS.has(String(date))}
getDayProps={({ date }: CalendarDayContext) => (PAYDAYS.has(String(date)) ? { className: 'demo-payday', title: 'Payday', 'data-payday': true } : undefined)}
renderDay={({ date }: CalendarDayContext) => (
// The payday dot sits under the number, so the number stays centred in its cell.
<span style={{ position: 'relative' }}>
{date.day}
{PAYDAYS.has(String(date)) ? (
<span aria-hidden="true" style={{ position: 'absolute', insetInline: 0, insetBlockStart: '0.9em', textAlign: 'center', lineHeight: 1 }}>
•
</span>
) : null}
</span>
)}
/>
<Calendar aria-label="Month of report" locale="en-US" granularity="month" defaultValue="2026-11-01" />
<Calendar aria-label="Buddhist calendar" locale="th-TH" calendar="buddhist" defaultValue="2026-11-23" weekdayFormat="narrow" />
<Calendar aria-label="Islamic calendar" locale="ar-SA" calendar="islamic-umalqura" defaultValue="2026-11-23" weekdayFormat="narrow" dir="rtl" />
</div>
);
}
Disabled days stay focusable but cannot be selected. The Islamic calendar lays out its own months while the value stays an ISO date; in RTL the Left and Right arrow keys are mirrored.