Input Date
newFor birthdays, deadlines and other dates you'd rather not think about.
Selected: 1990-06-21
Open Props in the corner of the example to try variant, size, disabled, readonly and loading. disabled fades the frame and the segments; readonly keeps the date focusable but not editable.
The five text control variants, the same as on Input.
The field runs from 28px at xs to 48px at xl, the heights of the matching inputs.
Installation
Usage
<script setup lang="ts">
import { CalendarDate } from '@internationalized/date'
import type { DateValue } from 'reka-ui'
import { InputDate } from '@/components/ui/input-date'
const date = shallowRef<DateValue | undefined>(new CalendarDate(2025, 3, 14))
</script>
<template>
<InputDate v-model="date" />
</template>
Day, month and year are separate segments, in the order the locale writes them. Type digits or use the arrow keys; once a segment is full, focus jumps to the next one. Paste an ISO date such as 2025-03-14 to fill them all at once.
v-model is a CalendarDate from @internationalized/date, or undefined until every segment is filled. toString() gives the ISO date, and parseDate() reads one back.
Set name, and it submits as YYYY-MM-DD. Give it an aria-label, or put it in a Field.
Examples
Range
InputDateRange puts a start and an end date in one frame. Its v-model is { start, end }. An end before the start marks both ends invalid.
With name, the form gets two fields, name[start] and name[end], each an ISO date and empty until that end is filled. required needs both.
14 nights.
Date and time
Pass a CalendarDateTime and set granularity to hour, minute or second, and the time segments follow the date in the same field. hour-cycle picks 24 or 12; 12 adds the AM/PM segment.
Min and max
A date before min-value or after max-value marks the segments aria-invalid, which turns the frame destructive. Put invalid on the field to show the error.
The model updates while the year is typed, so 2025 passes through 0002 and 0020 on the way. Check the date on submit, or after the field loses focus, not on every keystroke.
Unavailable dates
is-date-unavailable rules out single dates: weekends, holidays, sold-out days. An unavailable date is invalid, the same as one outside min and max.
Locale
There is no format prop. The segment order and the separators come from locale, or from Reka UI's ConfigProvider when it's not set.
Loading
loading puts a spinner at the end of the field and marks it aria-busy. Typing stays on.
Checking whether the hall is free…
In an input group
Inside an InputGroup the field drops its own frame and takes the group's variant and size, so icons, text and buttons share one frame with it. Clicking an addon focuses the first segment.
Form
Bind v-model, name and the focus and blur events rather than spreading a form library's whole field object: placeholder here is a date, not hint text, so a string placeholder from the library would break it. focus and blur fire once per field, not once per segment, so validate-on-blur works.
The field's element is a group, not an input. Register its first segment with the form library so it can focus the field after a failed submit.
A value set from outside the field, by a Today button or a calendar, fires neither event. If your form validates on blur only, validate on input too.
Known limits
These come from Reka UI's DateField, which is still alpha upstream.
- Typing into the last segment never stops: a fifth year digit starts the year over (reka-ui#2002).
- Backspace in an empty segment doesn't move back to the previous one (reka-ui#1758).
- Copy and select-all are blocked in the segments; paste works (reka-ui#1897).
- A form reset, or clearing
v-model, doesn't empty a half-typed field: the value was alreadyundefined, so nothing changes (reka-ui#1939). Reset the field by remounting it with a newkey. - No month-and-year field, for card expiry dates and the like (reka-ui#2099).
InputDateRangehas nostep-snapping(reka-ui#2789).- The segments' screen reader labels ("day", "month", "year") are English only.
- With a non-Gregorian locale such as
fa-IRorth-TH,InputDate's hidden input writes that calendar's year, month and day. Convert to Gregorian withtoCalendar()before you trust a submitted value, or sendv-modelinstead (nuxt/ui#6371).InputDateRangealways submits Gregorian dates. - A
ZonedDateTimeshows a time zone segment that's a textbox, not a spinbutton, so it doesn't ring the frame when focused. Hide it withhide-time-zone. - TypeScript errors about "separate declarations of a private property" on
CalendarDatemean two copies of@internationalized/dateare installed. Keep one, withpnpm dedupeor an override (nuxt/ui#5965).
API Reference
Both components accept class, merged over their base classes.
InputDate
| Prop | Default | Type and description |
|---|---|---|
| defaultValue | — | DateValueThe starting date when |
| defaultPlaceholder | — | DateValueThe starting placeholder when |
| placeholder | — | DateValueThe date the segments step from while they are empty, not hint text. Its type decides the segments: a |
| modelValue | — | DateValue | nullThe date, bound with |
| hourCycle | — | HourCycle
|
| step | — | DateStepHow far the arrow keys move each segment, as |
| stepSnapping | — | booleanSnaps a typed time to the nearest step. |
| granularity | — | GranularityThe last segment shown: |
| hideTimeZone | — | booleanHides the time zone segment that a |
| maxValue | — | DateValueThe latest valid date. A later one marks the segments invalid and fails the hidden input's |
| minValue | — | DateValueThe earliest valid date. An earlier one marks the segments invalid and fails the hidden input's |
| locale | — | stringThe locale for the segment order and the literals. Defaults to the one Reka UI's |
| disabled | — | booleanDisables every segment. Also set by a disabled field. |
| readonly | — | booleanKeeps the segments focusable but not editable. |
| isDateUnavailable | — | MatcherA function that returns |
| id | — | stringOverrides the |
| dir | — | DirectionThe reading direction. Defaults to the one Reka UI's |
| asChild | — | booleanRender the single child instead of a wrapper, merging the root's attributes and classes onto it. |
| as | — | AsTag | ComponentThe element or component to render. |
| name | — | stringSubmits the date with the form under this name, through a hidden input: |
| required | — | booleanMarks the hidden form input required. Also set by a required field. |
| variant | "outline" | "outline" | "soft" | "filled" | "ghost" | "subtle"The text control look, shared with |
| size | "md" | "md" | "xs" | "sm" | "lg" | "xl"The field's height, from 28px at |
| loading | — | booleanShows a spinner at the end of the field and marks it |
| Event | Payload and description |
|---|---|
| update:modelValue | [date: DateValue | undefined]Fires when a typed, stepped or pasted segment completes or clears the date. |
| update:placeholder | [date: DateValue]Fires when the placeholder date changes. |
| focus | [event: FocusEvent]Fires once when focus enters the field, not for every segment. |
| blur | [event: FocusEvent]Fires once when focus leaves the field. |
InputDateRange
| Prop | Default | Type and description |
|---|---|---|
| defaultValue | — | DateRangeThe starting range when |
| defaultPlaceholder | — | DateValueThe starting placeholder when |
| placeholder | — | DateValueThe date the segments step from while they are empty, not hint text. Its type decides the segments: a |
| modelValue | — | DateRange | nullThe range, bound with |
| hourCycle | — | HourCycle
|
| step | — | DateStepHow far the arrow keys move each segment, as |
| granularity | — | GranularityThe last segment shown: |
| hideTimeZone | — | booleanHides the time zone segments that |
| maxValue | — | DateValueThe latest valid date for either end. A later one marks the segments invalid and fails the hidden input's |
| minValue | — | DateValueThe earliest valid date for either end. An earlier one marks the segments invalid and fails the hidden input's |
| locale | — | stringThe locale for the segment order and the literals. Defaults to the one Reka UI's |
| disabled | — | booleanDisables every segment. Also set by a disabled field. |
| readonly | — | booleanKeeps the segments focusable but not editable. |
| isDateUnavailable | — | MatcherA function that returns |
| id | — | stringOverrides the |
| dir | — | DirectionThe reading direction. Defaults to the one Reka UI's |
| asChild | — | booleanRender the single child instead of a wrapper, merging the root's attributes and classes onto it. |
| as | — | AsTag | ComponentThe element or component to render. |
| name | — | stringSubmits |
| required | — | booleanMarks both hidden form inputs required, so the range needs both ends. Also set by a required field. |
| variant | "outline" | "outline" | "soft" | "filled" | "ghost" | "subtle"The text control look, shared with |
| size | "md" | "md" | "xs" | "sm" | "lg" | "xl"The field's height, from 28px at |
| loading | — | booleanShows a spinner at the end of the field and marks it |
| Event | Payload and description |
|---|---|
| update:modelValue | [date: DateRange]Fires with |
| update:placeholder | [date: DateValue]Fires when the placeholder date changes. |
| focus | [event: FocusEvent]Fires once when focus enters the field, not for every segment. |
| blur | [event: FocusEvent]Fires once when focus leaves the field. |
Props
- defaultValue
DateValueThe starting date whenv-modelis not used.- defaultPlaceholder
DateValueThe starting placeholder whenv-model:placeholderis not used.- placeholder
DateValueThe date the segments step from while they are empty, not hint text. Its type decides the segments: aCalendarDateTimeadds time. Bound withv-model:placeholder.- modelValue
DateValue | nullThe date, bound withv-model. ACalendarDate,CalendarDateTimeorZonedDateTimefrom@internationalized/date, orundefinedwhile a segment is empty.- hourCycle
HourCycle12or24for the time segments. Defaults to the locale's cycle;12adds an AM/PM segment.- step
DateStepHow far the arrow keys move each segment, as{ year, month, day, hour, minute, second }.1by default.- stepSnapping
booleanSnaps a typed time to the nearest step.- granularity
GranularityThe last segment shown:day,hour,minuteorsecond. Defaults todayfor aCalendarDateandminutefor a value with time.- hideTimeZone
booleanHides the time zone segment that aZonedDateTimevalue shows.- maxValue
DateValueThe latest valid date. A later one marks the segments invalid and fails the hidden input'smax. A date without time covers that whole day.- minValue
DateValueThe earliest valid date. An earlier one marks the segments invalid and fails the hidden input'smin.- locale
stringThe locale for the segment order and the literals. Defaults to the one Reka UI'sConfigProvidersets.- disabled
booleanDisables every segment. Also set by a disabled field.- readonly
booleanKeeps the segments focusable but not editable.- isDateUnavailable
MatcherA function that returnstruefor a date that cannot be picked. Such a date marks the segments invalid.- id
stringOverrides theidtaken from a surrounding field. It lands on the hidden input, so the field's label focuses the first segment.- dir
DirectionThe reading direction. Defaults to the one Reka UI'sConfigProvidersets.- asChild
booleanRender the single child instead of a wrapper, merging the root's attributes and classes onto it.- as
AsTag | ComponentThe element or component to render.- name
stringSubmits the date with the form under this name, through a hidden input:YYYY-MM-DD, orYYYY-MM-DDTHH:mmwith time, plus:ssat thesecondgranularity.- required
booleanMarks the hidden form input required. Also set by a required field.- variant
"outline" "outline" | "soft" | "filled" | "ghost" | "subtle"The text control look, shared withInput:outline,soft,filled,ghostorsubtle. Inside an input group, the group's.- size
"md" "md" | "xs" | "sm" | "lg" | "xl"The field's height, from 28px atxsto 48px atxl. Inside an input group, the group's.- loading
booleanShows a spinner at the end of the field and marks itaria-busy.
Emits
- update:modelValue
[date: DateValue | undefined]Fires when a typed, stepped or pasted segment completes or clears the date.- update:placeholder
[date: DateValue]Fires when the placeholder date changes.- focus
[event: FocusEvent]Fires once when focus enters the field, not for every segment.- blur
[event: FocusEvent]Fires once when focus leaves the field.
Props
- defaultValue
DateRangeThe starting range whenv-modelis not used.- defaultPlaceholder
DateValueThe starting placeholder whenv-model:placeholderis not used.- placeholder
DateValueThe date the segments step from while they are empty, not hint text. Its type decides the segments: aCalendarDateTimeadds time. Bound withv-model:placeholder.- modelValue
DateRange | nullThe range, bound withv-model, as{ start, end }. Each end is a date from@internationalized/date, orundefineduntil its segments are filled.- hourCycle
HourCycle12or24for the time segments. Defaults to the locale's cycle;12adds an AM/PM segment.- step
DateStepHow far the arrow keys move each segment, as{ year, month, day, hour, minute, second }.1by default.- granularity
GranularityThe last segment shown:day,hour,minuteorsecond. Defaults todayfor aCalendarDateandminutefor a value with time.- hideTimeZone
booleanHides the time zone segments thatZonedDateTimevalues show.- maxValue
DateValueThe latest valid date for either end. A later one marks the segments invalid and fails the hidden input'smax. A date without time covers that whole day.- minValue
DateValueThe earliest valid date for either end. An earlier one marks the segments invalid and fails the hidden input'smin.- locale
stringThe locale for the segment order and the literals. Defaults to the one Reka UI'sConfigProvidersets.- disabled
booleanDisables every segment. Also set by a disabled field.- readonly
booleanKeeps the segments focusable but not editable.- isDateUnavailable
MatcherA function that returnstruefor a date that cannot be picked. A range holding one is invalid.- id
stringOverrides theidtaken from a surrounding field. It lands on the start's hidden input, so the field's label focuses the first segment.- dir
DirectionThe reading direction. Defaults to the one Reka UI'sConfigProvidersets.- asChild
booleanRender the single child instead of a wrapper, merging the root's attributes and classes onto it.- as
AsTag | ComponentThe element or component to render.- name
stringSubmitsname[start]andname[end]with the form, eachYYYY-MM-DD(orYYYY-MM-DDTHH:mmwith time, plus:ssat thesecondgranularity) and empty while unset.- required
booleanMarks both hidden form inputs required, so the range needs both ends. Also set by a required field.- variant
"outline" "outline" | "soft" | "filled" | "ghost" | "subtle"The text control look, shared withInput:outline,soft,filled,ghostorsubtle. Inside an input group, the group's.- size
"md" "md" | "xs" | "sm" | "lg" | "xl"The field's height, from 28px atxsto 48px atxl. Inside an input group, the group's.- loading
booleanShows a spinner at the end of the field and marks itaria-busy.
Emits
- update:modelValue
[date: DateRange]Fires with{ start, end }when a segment of either end changes, or a date is pasted.- update:placeholder
[date: DateValue]Fires when the placeholder date changes.- focus
[event: FocusEvent]Fires once when focus enters the field, not for every segment.- blur
[event: FocusEvent]Fires once when focus leaves the field.
Data attributes
| data-slot | Attributes | Description |
|---|---|---|
| input-date | data-variant, data-size, data-disabled, data-readonly, data-invalid | The frame, a role="group", holding the hidden form input. Inside an input group it is input-group-control. |
| input-date-range | data-variant, data-size, data-disabled, data-readonly, data-invalid | The range's frame, the same as input-date, holding a hidden input for each end. |
| input-date-segment | data-reka-date-field-segment, data-reka-date-range-field-segment-type, data-placeholder, data-disabled, data-invalid, aria-invalid | One segment, a role="spinbutton", or a literal such as the slash. In a range, data-reka-date-range-field-segment-type says which end it belongs to. |
| input-date-range-separator | aria-hidden | The dash between the start and the end. |
Accessibility
The frame is a group, labelled and described by its field. Each segment is a spinbutton with its own value and range, and reads "Empty" until it's filled. The literals and the range's dash are skipped.
- The hidden form input takes the field's
id, so clicking the label focuses the first segment. - Clicking the frame outside the segments focuses the first one too.
- Invalid segments carry
aria-invalid, and the frame turns destructive. - A readonly field stays in the tab order; a disabled one leaves it.
| Key | Action |
|---|---|
| Tab / Shift + Tab | Moves through the segments, each one a tab stop, then out of the field. |
| 0–9 | Types into the segment and moves to the next one when it is full. Typing into a full segment starts it over. |
| ArrowUp / ArrowDown | Steps the segment by step, wrapping around. |
| ArrowLeft / ArrowRight | Moves focus to the previous or next segment. In right-to-left they swap. |
| Backspace | Deletes the last digit, then empties the segment, which makes the value undefined. Focus stays on the segment. |
| A / P | Sets AM or PM in the 12-hour cycle. |
| Ctrl + V / ⌘ + V | Pastes an ISO date, 2025-03-14 or 2025-03-14T09:30. In a range, it fills the end that has focus; 2025-03-14/2025-03-21 fills both. |
| Enter | Submits the form like a native date input. It clicks the submit button and does nothing while that button is disabled; without one, it submits only when this is the form's single text field. |