Demo
Range calendar with two months
Documented in RangeCalendar.
Range calendar with two months
RangeCalendar with two visible months, hover and focus preview, minDays and maxDays, a disabled day that blocks the range, and the getRangeDays helper.
November 2026
| 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 | |||||
December 2026
| 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 | ||
2026-11-09/2026-11-13 · 5 days
Demo.tsx
'use client';
import { useState } from 'react';
import { getRangeDays, RangeCalendar, toPlainDate, type DateRange, type PlainDate } from '@salmonui/calendars/calendar';
const TRIP: DateRange = { start: toPlainDate('2026-11-09') as PlainDate, end: toPlainDate('2026-11-13') as PlainDate };
/** A two-month RangeCalendar with a 3 to 14 day span and a blocked holiday. */
export default function RangeCalendarDemo() {
const [range, setRange] = useState<DateRange | null>(TRIP);
return (
<div className="demo-stack">
<RangeCalendar
aria-label="Trip dates"
locale="en-US"
visibleMonths={2}
defaultValue={TRIP}
minDays={3}
maxDays={14}
isDateDisabled={(date) => String(date) === '2026-11-26'}
rangeOverDisabled="block"
onValueChange={setRange}
/>
<p className="demo-status" aria-live="polite">
{range ? (
<>
<code>
{String(range.start)}/{String(range.end)}
</code>{' '}
· {getRangeDays(range)} days
</>
) : (
'Choose a start date, then an end date.'
)}
</p>
</div>
);
}
After the first click the days outside the allowed span are disabled and the range previews under the pointer or the keyboard focus. A live region announces the start, then the complete range with its day count.