Skip to content

Date Picker

SDatePicker combines a segmented date input (SDateField) with a popover calendar (SCalendar): the date can be typed on the keyboard or picked with the mouse. It is built on SFormField (label, hint, error message), the navigation uses SIcon. The value is a DateValue from @internationalized/date. The calendar opens in a portal, so the demos are wrapped in <ClientOnly>. 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 selection, and the isDateDisabled predicate disables arbitrary days (weekends in the example). Disabled days cannot be clicked in the calendar.

Calendar settings

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.

Leaving the field

Like SInput, the field emits focus and blur events, for example to validate the value once the user leaves the field. Moving between segments and into the calendar does not count as leaving: blur fires when focus has left both the field and the open calendar. SDateRangePicker, SDateField, and STimeField emit the same events.

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.

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).
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 | CalendarDate | CalendarDateTime | ZonedDateTimeundefinedSelected date (DateValue). Two-way binding via v-model.

Events

NameSignatureDescription
update:modelValue( value: | CalendarDate | CalendarDateTime | ZonedDateTime | 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).