Range Calendar Component — Astro

Date range selection calendar. Two clicks set start and end; fires range-calendar-select with start and end (YYYY-MM-DD).

Range Calendar Component

A calendar for selecting a date range. Click once to set the start date, then click again to set the end date (order is normalized so start ≤ end). Uses the same BEM structure as Calendar with calendar--range and range state modifiers. Fires range-calendar-select when both dates are set.

Add this component

Run the command below in your project directory. When prompted, select the component(s) you want. The CLI will copy the CSS and component files.

Choose your package manager — click a tab to select, then copy the command.

npm pnpm yarn bun

Props

  • id (string, optional) — Unique id (auto-generated if omitted)
  • initialMonth (string, optional) — Initial month as YYYY-MM
  • rangeStart (string, optional) — Initial range start as YYYY-MM-DD
  • rangeEnd (string, optional) — Initial range end as YYYY-MM-DD
  • label (string, optional) — Accessible label (default: "Choose date range")
  • class (string, optional) — Additional CSS classes

Events

Listen for range-calendar-select on the calendar element. event.detail has start and end (YYYY-MM-DD).

Live Example

Range Calendar
—
Sun
Mon
Tue
Wed
Thu
Fri
Sat

Usage

Usage

Full example for each framework (Astro, Vanilla, Svelte, Vue, React). Switch framework via View as or by clicking a Usage tab—both stay in sync.

Astro Vanilla Svelte Vue React

Other frameworks: Vanilla ¡ Svelte ¡ Vue ¡ React