Date Range Picker
ProNewA range field with presets beside two months. The range previews under the pointer and applies on the second press.
Installation
pnpm dlx shadcn@latest add @viewport/date-range-picker
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| value | DateRange | — |
| defaultValue | DateRange | { from: null, to: null } |
| onValueChange | (range: DateRange) => voidRuns when a complete range is applied, from a preset or from the second press on the calendar. | — |
| placeholder | stringShown while no range is chosen. | "Pick a date range" |
| presets | RangePreset[]Shortcuts listed beside the calendar. Pass an empty array to hide them. | defaultRangePresets |
| locale | string | — |
| min | Date | — |
| max | Date | — |
| weekStart | 0 | 1 | — |
Accessibility
- Presets are buttons that state which one is active.
- The preview follows keyboard focus as well as the pointer.
- One month and a scrolling preset row on phones.
- Closing without finishing keeps the previous range.