Skip to content

DateRangePicker

Shared Components

Date range selector with native date inputs and preset ranges.

Custom date inputsFive relative presets
Open preview

Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.

Usage

Pass a complete range with from and to Dates. This picker uses native date inputs and relative presets, not a dual-calendar view. Presets calculate relative to the current date when selected.

Import
import {
  DateRangePicker,
  type DateRange,
} from "@dashboardpack/core/components/shared/date-range-picker";

Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.

API reference

Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.

DateRangePicker props
PropType / DefaultDescription
valueDateRange: { from: Date; to: Date }

Default: required

Current complete date range.
onChange(range: DateRange) => void

Default: required

Receives a valid range.
classNamestring

Default: —

Extend trigger styles.

Build with these too