Skip to content

Date Range Picker

SDateRangePicker picks a date range — a start and an end — with a single field and a pair of months in the calendar. Days in between are highlighted, the range ends are filled with the accent color. Like SDatePicker, it is built on SFormField and opens the calendar in a portal. The value is a { start, end } object with DateValue dates from @internationalized/date. Keep the value in a shallowRef, not a ref: a regular ref unwraps the date class, and type checking no longer recognizes it as a DateValue.

Basic usage

Hint, error message, and date limits

Sizes

The size prop changes the field height: sm (28px), md (36px, the default), or lg (44px).

States

disabled locks the field and the calendar, readonly prevents changing the value, required adds * to the label, invalid marks the field as invalid without an error text.

Date limits

maxValue sets the upper bound of the range, and the isDateDisabled predicate disables arbitrary days (weekends in the example). Disabled days cannot be clicked in the calendar.

Calendar settings

numberOfMonths sets how many months are shown at once (2 by default), weekStartsOn changes the first day of the week (1 is Monday), and fixedWeeks set to false turns off the stable 6-week grid height. The effect is visible with the calendar open.

prepend / append slots

The prepend and append slots add content inside the field frame, such as an icon or a button, next to the standard calendar trigger.

Leaving the field

The field emits focus and blur events, like SInput. Moving between segments and into the calendar does not count as leaving the field — see the details and a validation example on the SDatePicker page.

API

Props

NameTypeDefaultDescription
idstringundefinedField id. Generated automatically when not set (SSR-safe).
labelstringundefinedField label.
hintstringundefinedHint below the field.
errorstringundefinedError message. When set, the field is marked invalid.
size"md" | "sm" | "lg""md"Field size: sm (32px), md (40px) or lg (48px).
disabledbooleanfalseDisables the field and opening the calendar.
readonlybooleanfalseRead-only: the value cannot be changed.
requiredbooleanfalseMarks the field as required: draws * next to the label.
invalidbooleanfalseExplicitly marks the field invalid (in addition to error).
squarebooleanundefinedSquare corners: removes the rounding of the field frame (rounded by default).
floating-labelbooleantrueFloating label: the label lives inside the frame, looks like a placeholder at rest and moves up to the top border on focus or when filled. On by default; false gives a regular label above the field. The label size is fixed and does not depend on size.
localestringundefinedFormatting locale (e.g. en-GB). By default it is derived from the library locale (ConfigProvider/installLocale, the locale option in Nuxt): enen-US.
min-value | CalendarDate | CalendarDateTime | ZonedDateTimeundefinedMinimum allowed date.
max-value | CalendarDate | CalendarDateTime | ZonedDateTimeundefinedMaximum allowed date.
week-starts-on0 | 1 | 2 | 3 | 4 | 5 | 6undefinedFirst day of the week: 0 is Sunday, 1 is Monday, and so on.
fixed-weeksbooleantrueAlways show 6 weeks (stable grid height).
number-of-monthsnumber2Number of months shown at once.
is-date-disabled((date: CalendarDate | CalendarDateTime | ZonedDateTime) => boolean)undefinedPredicate function: return true to disable a specific date.
open-calendar-labelstringundefinedAccessible name of the open-calendar button (defaults to the locale dictionary).
prev-month-labelstringundefinedAccessible name of the "previous month" button (defaults to the locale dictionary).
next-month-labelstringundefinedAccessible name of the "next month" button (defaults to the locale dictionary).
flatbooleanundefinedRemoves the shadow. Overridden by the elevation prop when it is set.
elevation0 | 1 | 2 | 3 | 4 | 5undefinedShadow level 0–5 (scale); 0 means no shadow. Overrides flat.
model-value{ start: | CalendarDate | CalendarDateTime | ZonedDateTime; end: | CalendarDate | CalendarDateTime | ZonedDateTime }undefinedSelected range { start, end }. Two-way binding via v-model.

Events

NameSignatureDescription
update:modelValue(value: SDateRange | undefined) => voidEmitted when modelValue changes. Used for two-way binding (v-model).
focus(event: FocusEvent) => voidFocus entered the field. Moving between segments or into the calendar does not count.
blur(event: FocusEvent) => voidFocus left the field. Moving between segments or into the calendar does not count.

Slots

NameDescription
prependContent at the start of the field, inside the frame (icon, button).
appendContent at the end of the field, inside the frame (icon, button).