DateRangePicker
A hand-built date range picker in the Neon language.
DateRangePicker is a range picker built from scratch in the house vocabulary — no calendar library. The trigger is a mono pill reading the range; the panel opens with a preset rail (one click, done) beside a single month grid. Pick a start and the tentative range washes primary/10 under the pointer; the second click lands the end and closes. Today wears a hairline ring, never color — color belongs to the selection. UsagePanel rides it in the filter slot to drive consumption queries.
Install
npx shadcn@latest add https://ui.neon.com/r/date-range-picker.json
Usage
import { DateRangePicker } from "@/components/neon-ui/date-range-picker";
<DateRangePicker
value={range}
onValueChange={(next) => {
setRange(next);
refetchUsage(next);
}}
/>;
Props
PropType
valueDateRange
{ from: Date; to: Date }
Type
DateRangeonValueChange(range: DateRange) => void
Fires when a range lands (second click or preset).
Type
(range: DateRange) => voidpresets?DateRangePreset[]
Quick ranges in the rail: { label, days }.
Type
DateRangePreset[]Default
last 7 / 14 / 30 daysdisableFuture?boolean
Days after today stay unselectable.
Type
booleanDefault
trueAccessibility
- Every day is a real button labelled by its number inside a labelled month; disabled future days are
disabled. - Presets and month navigation are plain buttons — the whole panel is keyboard-traversable with Tab.
- The Base UI popover contributes focus management, Escape dismissal, and outside-click close.
- Panel entrance and month crossfade are static under
prefers-reduced-motion.