Avara UI

Shadcn Date Range Picker

An interactive DateRangePicker with single-month, dual-month, rate-priced, and start/end time-rail variants for booking and scheduling flows.

Applies to this page's previews only

About Shadcn Date Range Picker

What it is. DateRangePicker handles start-to-end date range selection across single, dual, priced-single, and priced-dual layouts, with optional disablePast bounds, getPrice per-day rate labels, and showTime start/end time rails.

How it is built. Built with native Date math and theme-aware color schemes (primary, indigo, rose, emerald, zinc).

When to use it. Use DateRangePicker for hotel/flight booking ranges, analytics date filters, and availability windows. For single dates, use Date Picker.

Features.

  • Single & Dual Priced Calendars (variant="priced-single" | "priced-dual"): Renders dynamic rate prices ($100, $120) directly below each date number for hotel room or flight booking workflows in both single and dual month views.
  • Dual Calendar Layout (variant="dual"): Displays two calendars side by side (Month N and Month N+1), stacked on narrow screens. Both belong to one range, so the start and end can fall in either month.
  • Single Calendar Layout (variant="single"): Compact single-month view ideal for smaller screens or compact forms.
  • Custom Price Formatter (getPrice): Accepts a callback that returns a string, number or null for each date, so rates can come from an API or static pricing rules.
  • Range Selection Engine: Click any start date and end date to highlight the span with smooth background effects.
  • Color Themes: Built-in "primary", "indigo", "rose", "emerald", and "zinc" color schemes.

For AI agents

Hand your agent this brief or the Markdown page, not a screenshot.

When to use

  • Date-span selection ({ from, to }) in single or dual-month calendars
  • Priced booking calendars (variant="priced-single" | "priced-dual", getPrice) or ranges with start/end times (showTime)

When not to use

Agent notes

  • Named exports: DateRangePicker, type DateRange from @/components/custom/date-range-picker
  • Controlled use takes value and onChange with a DateRange ({ from, to }, each a Date or null). onChange fires on every click, so the first click of a new range gives to: null.
  • Prices show when showPrices is set, the variant is priced-single or priced-dual, or getPrice is passed. Without getPrice the placeholders are $100 on weekdays and $120 on weekends, so always pass your own.
  • Pass disablePast to block past dates from starting or ending a range; disabled greys out the whole card.
  • showTime adds Start and End time columns built from the time-picker registry dependency.
For AI agents4 variants. Ask the user which one.

Ask before you pick. This page has 4 variants. If the user has not named one and has not asked you to choose for them, ask which they want before you install anything or write code, and show every option with its live link. If they ask you to choose, pick from each variant's best-for and avoid-if lines against their brief, and say why. If the user named a variant, use it and do not ask.

All 4 options as live previews: https://avaraui.com/view/date-range-picker

When to use it. A date range picker for hotel or flight booking, in four layouts: one or two months, each with or without a price under every day.

When to use something else

  • Date Picker: for choosing a single date in a form field.

Gotchas

  • All four are looks of the one `date-range-picker` item: install it once and set `variant` from the index.
  • Past dates are blocked with `disablePast` (and `minDate` / `maxDate` bound the window) and start and end times come from `showTime`: both are props on any layout.

The 4 variants

  1. Single month single

    One month at a time for choosing a start and end date.

    • Best for: a compact picker in a narrow space or on mobile
    • Avoid if: people often pick ranges that span two months
    • Traits: one month, no prices
    • Install: npx shadcn@latest add @avara-ui/date-range-picker
    • Docs section
  2. Single month with prices priced-single

    One month with a price shown for each day.

    • Best for: a compact booking widget where the nightly or daily rate matters
    • Avoid if: you have no per-day price to show
    • Traits: one month, price per day
    • Install: npx shadcn@latest add @avara-ui/date-range-picker
    • Docs section
  3. Dual month dual

    Two months side by side, so a range across a month boundary is visible at once.

    • Best for: a desktop booking flow where ranges often span two months
    • Avoid if: the space is narrow
    • Traits: two months, no prices
    • Install: npx shadcn@latest add @avara-ui/date-range-picker
    • Docs section
  4. Dual month with prices priced-dual

    Two months side by side with a price on each day.

    • Best for: a hotel or flight search where comparing prices across two months helps
    • Avoid if: you have no per-day price to show, or the space is narrow
    • Traits: two months, price per day
    • Install: npx shadcn@latest add @avara-ui/date-range-picker
    • Docs section
Install
npx shadcn@latest add https://avaraui.com/r/date-range-picker.json
Registry name
@avara-ui/date-range-picker, through the shadcn MCP server
Index
llms.txt lists every page, or add the agent skill once

Props Reference

PropTypeDefaultDescription
variant"single" | "dual" | "priced-single" | "priced-dual""single"Calendar layout variant. "priced-single" & "priced-dual" render price tags below date numbers.
showPricesbooleanfalseToggles visibility of price labels underneath dates.
getPrice(date: Date) => string | number | nullundefinedCustom pricing formatter function to return dynamic rates per date.
value{ from: Date | null; to: Date | null }undefinedControlled date range value object.
onChange(range: DateRange) => voidundefinedCallback fired when date range is selected or reset.
defaultFromDate | nullLast 7 DaysInitial start date for uncontrolled state.
defaultToDate | nullTodayInitial end date for uncontrolled state.
color"primary" | "indigo" | "rose" | "emerald" | "zinc""primary"Theme color variant for highlights and buttons.
disablePastbooleanfalseGreys out every day before today so it cannot start or end a range. With showTime, times already passed today are disabled too.
minDateDateundefinedEarliest selectable day (inclusive). Combined with disablePast, the later bound wins.
maxDateDateundefinedLatest selectable day (inclusive).
showTimebooleanfalseAdds Start / End time columns. The card opens with the calendar alone and starts empty when uncontrolled; picking a start day unfolds the columns to the right of a single-month calendar when there is room for the wider card, under it otherwise (dual-month always stacks). Clear folds them away. Both from and to carry a time; on a same-day range the end can never precede the start.
timeFormat"12h" | "24h""12h"12-hour clock with an AM / PM column, or a 24-hour one.
minuteStepnumber5Minute granularity of the time columns.

Works with other components

How do I show nightly prices under each calendar day in DateRangePicker?

Use variant="priced-single" or "priced-dual" and pass getPrice={(date) => ...}, returning a string, a number or null for that day. Without getPrice the picker shows placeholder rates, $100 on weekdays and $120 on weekends, so always supply your own.

How do I read the selected range from DateRangePicker?

Pass value and onChange. onChange receives a DateRange, { from, to } with each a Date or null, and fires on every click, so the first click of a range arrives with to: null. Uncontrolled, defaultFrom and defaultTo start it at seven days ago and today.

How do I stop DateRangePicker from selecting past dates?

Set disablePast, or bound the calendar with minDate and maxDate, both inclusive. Disabled days are struck through and cannot be clicked. When disablePast and minDate are both set, the later bound wins. With showTime, times already passed today are disabled too.

How do I add start and end times to DateRangePicker?

Set showTime. The card opens with the calendar alone, and picking a start day unfolds Start and End time columns beside it, or under it on a narrow card. Use timeFormat="24h" and minuteStep to adjust them. On a same-day range the end can never precede the start.

Which colors does DateRangePicker support?

color accepts "primary", "indigo", "rose", "emerald" and "zinc". "primary" follows your theme tokens, so a Themes preset restyles it, while the others use fixed Tailwind palette colors that stay the same across themes. Any other string falls back to "primary", so a typo never breaks the card.

Does DateRangePicker work in Vite and respect reduced motion?

Yes to both. The file imports nothing from next/*, and it needs only lucide-react plus the time-picker item the installer adds. The time rail's unfold animation switches off when the user prefers reduced motion. Day cells are plain buttons, so Tab reaches them and disabled days are skipped.