Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Range Calendar

A calendar where the reader picks a start day and an end day, with the days between them filled.

Built on the headless Range Calendar.See its API in Docs

Rendered by React 19.3.1

range-calendar.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/range-calendar.json

It also adds utils, button, calendar. The app needs its setup first: Installation.

Usage

RangeCalendar is the Calendar's markup on the range Root: the same previous and next buttons, headings and grids, the same visibleMonths, min, max, isDateDisabled, locale, buttonVariant, showOutsideDays, views and children. Its value is { start, end }, ISO date strings (defaultValue={{ start: '2026-11-10', end: '2026-11-13' }}), or null, and onValueChange(value, eventDetails) reports a range once, on the second press, ordered. Between the two presses the days from the first one to the one under the pointer or the focus are previewed with a lighter band, and Escape drops the pending start. isDateUnavailable(date, anchor) also gets the pending start, so a range cannot cross a booked day. The keys and the announcements come from the headless Range Calendar.

import { RangeCalendar } from '@/components/ui/range-calendar'

Examples

Default

Two months with the range chosen in them.

Its preview and code are at the top of the page.

shadcn has no item of its own for a range: it is the Calendar with mode="range", selected and onSelect({ from, to }). Here the range is { start, end } strings through value and onValueChange, and the Root is another component, so there is no mode and no required. Everything else that differs from shadcn's Calendar is listed on the Calendar page.

The first and the last day of the range are filled with the primary colour, joined by a muted band across the days between them that is closed at the ends of the week. The pending range is a lighter band without the fill. This item takes Base UI's component ID as its slug and imports the Calendar item's markup.

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Range Calendar's API reference.