Dashral Pro is on the wayGet 30% off at launch

Dashral

Date Range Picker

Pick a start and end day on a two-month calendar, or from shortcuts like “Last 7 days”.

$ pnpm dlx shadcn@latest add https://dashral.com/r/date-range-picker.json

Installation

$ pnpm dlx shadcn@latest add https://dashral.com/r/date-range-picker.json

Adds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:

components.json
{
  "registries": {
    "@dashral": "https://dashral.com/r/{name}.json"
  }
}

Then add components by name:

$ pnpm dlx shadcn@latest add @dashral/date-range-picker

Usage

example.tsx
import { DateRangePicker } from "@/components/dashral/date-range-picker"

<DateRangePicker label="Period" defaultValue={{ from: new Date(2026, 9, 1), to: new Date(2026, 9, 24) }} />

Examples

One month, another language

presets={[]} hides the shortcuts; locale formats the label.

Hotel stay

Two months, past days off, presets for common stays, and the price worked out from the nights.

Deluxe room, garden view

$128 a night

$128 × 3 nights
$384
Taxes and fees
$42
Total
$426

API reference

DateRangePicker

PropTypeDefault
value / defaultValueDateRange

{ from, to }, controlled or initial.

—
onValueChange(value: DateRange | undefined) => void

Called with the new value.

—
presets{ label: string; range: () => DateRange }[]

Shortcuts beside the calendar; [] hides them.

defaultDateRangePresets
numberOfMonthsnumber

Months side by side.

2
locale / formatOptionsstring / Intl.DateTimeFormatOptions

How the range is written on the button.

LocaleProvider's
disabledDaysMatcher

Days that can't be picked.

—
disabledboolean

The whole picker can't be used.

false
placeholderstring"Pick a date range"
labelReactNode

Shown above, linked to the control.

—
descriptionReactNode

A hint under the control.

—
errorboolean | ReactNode

true shows the error style; a message also shows under the control.

—
labelActionReactNode

At the end of the label's row, e.g. a “Forgot password?” link or the current value.

—
withAsteriskboolean

Marks the label with an asterisk, e.g. alongside required.

false
classNames{ root, label, description, error, trigger, content }

Classes for each part.

—

defaultDateRangePresets

Today, Yesterday, Last 7 days, Last 30 days, This month, Last month — worked out when picked.

Keyboard

KeysAction
EnterorSpaceOpen
TabMove between the shortcuts and the calendar
EnterPick a day: the first sets the start, the second the end
EscapeClose

Accessibility

  • The shortcuts are a labelled group of buttons; the calendar announces the range as it's picked.

Motion

  • Opens with a fade, a scale from 95%, a 2px blur clearing and a 4px slide from its trigger's side, on the spring (--duration-standard); closes faster (--duration-fast, --ease-exit). No blur with reduced motion.