Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Date Range Picker

ProNew

A 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

PropTypeDefault
valueDateRange—
defaultValueDateRange{ from: null, to: null }
onValueChange(range: DateRange) => void

Runs when a complete range is applied, from a preset or from the second press on the calendar.

—
placeholderstring

Shown while no range is chosen.

"Pick a date range"
presetsRangePreset[]

Shortcuts listed beside the calendar. Pass an empty array to hide them.

defaultRangePresets
localestring—
minDate—
maxDate—
weekStart0 | 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.