Components
Date range picker
Choose a start and end date with preset ranges.
pnpm dlx shadcn@latest add @caliper/date-range-pickerWhen to use
Use it for
- Reports, stays and filters spanning a period.
- You want shortcuts like Last 7 days.
Skip it when
- A single date is enough; use a date picker.
Installation
pnpm dlx shadcn@latest add @caliper/date-range-picker
Adds its 5 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
This is the code behind the preview above.
import { useState, type ReactNode } from "react" import { DateRangePicker, type DateRange } from "@/components/ui/date-range-picker" function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) { return ( <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting ${className}`}> <div className="grid gap-1"> <p className="font-medium">{title}</p> <p className="text-sm text-muted-foreground">{context}</p> </div> {children} </section> ); } export function StayRange() { const [range, setRange] = useState<DateRange>({ start: "2026-11-09", end: "2026-11-13" }); const nights = range.start && range.end ? Math.round((Date.parse(range.end) - Date.parse(range.start)) / 86_400_000) : 0; return ( <Panel title="Lisbon offsite" context="Casa do Rio · 8 guests from the Halden team"> <DateRangePicker label="Stay" value={range} onValueChange={setRange} /> <p role="status" className="text-sm text-muted-foreground">{nights > 0 ? `${nights} ${nights === 1 ? "night" : "nights"} · €${(nights * 1240).toLocaleString("en-US")} for the house` : "Choose arrival and departure."}</p> </Panel> ); }
API reference
DateRangePicker
component
Accessibility
It exposes status semantics, with aria-haspopup, aria-expanded, aria-hidden and aria-label kept in step with state. Changes that matter are announced through a live region.
Keyboard and focus handling comes from Radix popover: arrow keys move through items, Enter and Space select, and Escape closes and returns focus.
Motion
Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.