Skip to content

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

UIComponentsReact

Year Range Calendar

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

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

Rendered by React 19.3.1

year-range-calendar.tsx

Installation

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

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

Usage

YearRangeCalendar is the Year Calendar's markup on the range Root: the same buttons, heading, yearsPerPage, min, max, locale, buttonVariant and children. Its value is { start, end }, '2026' strings, or null, and onValueChange(value, eventDetails) reports a range once, on the second press, ordered. Between the two presses the years 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. The keys and the announcements come from the headless Year Range Calendar.

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

Examples

Default

A page of years with a span chosen.

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

The ends are filled with the primary color and joined by a muted band, as on the Range Calendar. This item takes Base UI's component ID as its slug and imports the Year 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 Year Range Calendar's API reference.