Date Range Picker

A date range picker with presets and a custom range flow.

Installation

npx shadcn-vue@latest add https://dsn-ui.pages.dev/r/dsn-date-range-picker.json

Usage

Basic Usage

Use the component as a simple date range input that stores a start and end string.

Value: { "start": "2026-04-12", "end": "2026-04-18" }

With Preset Ranges

Show built-in quick ranges first, then let the user switch into the custom calendar flow.

Value: undefined

Try the quick ranges first, then use Select date range for a manual range.

With Default View And Boundaries

Guide the calendar to a specific month and keep selection inside an allowed booking window.

Value: { "start": "2026-05-12", "end": "2026-05-16" }

With Placeholder, Locale, And Long Dates

Use a custom empty-state prompt while keeping localized range formatting for the chosen locale.

Value: undefined

With Custom Labels

Override the internal preset and action labels without changing the selected locale.

Value: { "start": "2026-04-08", "end": "2026-04-14" }

With Compact Formatting

Use short date formatting when you want a denser trigger display.

Value: { "start": "2026-04-03", "end": "2026-04-09" }

With Clear Event

Listen to the clear event to trigger side effects when the user resets the date range.

Value: { "start": "2026-04-12", "end": "2026-04-18" }
Note: When presets are provided, the popover opens on the quick-select list first. The custom calendar only appears after the user chooses the manual range action, which keeps the common flows faster.

Props

PropTypeDescription
v-model

{ start?: string; end?: string } | undefined

Default: undefined

Selected range model. Values are emitted as date strings in YYYY-MM-DD format.

Example: { start: "2026-04-12", end: "2026-04-18" }

minValue

string | Date | DateValue

Default: undefined

Minimum selectable date in the custom range calendar.

Example: 2026-05-10

maxValue

string | Date | DateValue

Default: undefined

Maximum selectable date in the custom range calendar.

Example: 2026-05-24

defaultDateView

string | Date | DateValue

Default: undefined

Controls which month is shown first when the picker opens with no current selection.

Example: 2026-05-01

placeholder

string

Default: undefined

Custom placeholder for the trigger input when no range is selected.

Example: Select reporting period

clearable

boolean

Default: false

Shows a clear button in the trigger when a range is selected and the popover is closed.

Example: true

presets

readonly DateRangePreset[]

Default: []

Preset options shown before the custom calendar. Built-in keys: last-7-days, last-30-days, this-month, last-month. Custom entries accept `{ id?, label, value }` where `value` is a fixed range or callback.

Example: ["last-7-days", { label: "Next 14 days", value: () => ({ start: new Date(), end: new Date() }) }]

locale

string

Default: en-US

Locale used for date formatting and language fallback.

Example: id-ID

dateStyle

Intl.DateTimeFormatOptions['dateStyle']

Default: medium

Controls the formatted trigger text. Possible values: full, long, medium, short.

Example: short

lang

Partial<LangItems>

Default: undefined

Overrides internal labels. Available keys: pick_date_range, clear_date, last_7_days, last_30_days, this_month, last_month, custom_date_range.

Example: { custom_date_range: "Pilih manual" }

Events

EventPayloadDescription
@clear

void

Triggered when the user clicks the clear button to reset the value.