Range Calendar

Calendar that selects a start and end date as a range. Install Range Calendar from the VLLNT UI registry with the shadcn CLI.

Report a bug

Calendar that selects a start and end date as a range. Part of the form family in VLLNT UI, it ships as a machine-readable registry entry — copy the source directly into your app with the shadcn CLI and own it, no runtime dependency on a component library.

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Installation

Add Range Calendar to your project with the shadcn CLI. The source lands in your codebase, ready to adapt:

pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/range-calendar.json

Source

"use client"; import { useState } from "react"; import type { DateRange } from "react-day-picker"; import { Calendar } from "../calendar"; /** Calendar that selects a start and end date as a range. */ export type RangeCalendarProps = { className?: string; defaultValue?: DateRange; numberOfMonths?: number; onValueChange?: (range?: DateRange) => void; value?: DateRange; }; function RangeCalendar({ className, defaultValue, numberOfMonths = 2, onValueChange, value, }: RangeCalendarProps) { const [internalValue, setInternalValue] = useState<DateRange | undefined>( defaultValue, ); const selected = value ?? internalValue; const handleSelect = (range: DateRange | undefined) => { if (value === undefined) { setInternalValue(range); } onValueChange?.(range); }; return ( <Calendar className={className} mode="range" numberOfMonths={numberOfMonths} onSelect={handleSelect} selected={selected} /> ); } export { RangeCalendar };

Stories

Explore every variant and state in the interactive Storybook:

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Dependencies

  • @vllnt/ui@^0.3.0