Skip to content

Date range picker

A range picker that grows from its trigger into two months with presets and a stretching range highlight.

InputsNew
npx shadcn@latest add @silicon-ui/date-range-picker

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/date-range-picker

Manually

  1. Install the dependencies

    npm install lucide-react motion
  2. Copy these files into your project

    • components/silicon-ui/date-range-picker/date-range-picker.tsx
    • components/silicon-ui/date-range-picker/date-range-picker.module.css

    Shared with other components. Skip any you already have.

    • components/silicon-ui/lib/use-today.ts
    • components/silicon-ui/lib/fluid-hover.tsx
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { DateRangePicker } from "@/components/silicon-ui/date-range-picker/date-range-picker";

API reference

PropTypeDefault
value

Controlled value. Pass `null` for no selection.

DateRange | null—
defaultValue

Uncontrolled starting value.

DateRange | nullnull
onChange

Called with the applied range.

(range: DateRange) => void—
label

Accessible name of the trigger and the dialog. Defaults to "Date range".

string"Date range"
placeholderstring"Select dates"
presetsDateRangePreset[]defaultDateRangePresets
minDateDate—
maxDateDate—
weekStartsOn

0 is Sunday, 1 is Monday. Defaults to 0.

0 | 1

01

0
localestring"en-US"
months

Force one or two months. `auto` picks two when the boundary is wide enough.

"auto" | 1 | 2"auto"
boundary

The element the panel should stay inside. Defaults to the viewport.

() => HTMLElement | null—
classNamestring—

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokens