Components

Date Range Field

Locale-ordered segmented start and end dates with aggregate validation, fixed endpoints, and native forms.

DateRangeField combines two segmented date inputs under one range model. It supports locale order, partial entry, range constraints, Field state, cancelable changes, and two native form values.

Use Date Range Field for typed start and end dates. Date Range Picker adds calendar selection.

Date values come from @internationalized/date. Install it beside Akaza UI when application code creates or transforms dates: pnpm add akaza-ui @internationalized/date.

Anatomy

  • root: Generated range group containing both endpoint fields.
  • start: Generated start-endpoint wrapper.
  • start field: Generated Date Field for the start value.
  • #start-literal: Replaces locale separators inside the start field.
  • #separator: Replaces the visual separator between endpoints.
  • end: Generated end-endpoint wrapper.
  • end field: Generated Date Field for the end value.
  • #end-literal: Replaces locale separators inside the end field.
  • hidden input: Generated aggregate validity control. Each endpoint Date Field also owns its ISO form input.

Date Range Field owns endpoint segment markup because focus movement, spinbutton values, partial text, labels, and validation must stay synchronized. Every visible generated part remains styleable through ui.

Usage

Required. Maximum 10 days; August 16 is unavailable.
Not submitted.

Examples

Field integration

Wrap Date Range Field in Field to inherit label, description, required, disabled, name, and error relationships. Aggregate validation stays quiet until users interact or submit.

<Field
  label="Travel dates"
  name="travel"
  description="Choose arrival and departure."
  required
>
  <DateRangeField v-model="range" />
</Field>

The default form names become travel.start and travel.end. Use startName and endName to override either name.

Range constraints

Boundaries apply to both endpoints. maximumDays counts both start and end. Unavailable dates inside a range invalidate it unless non-contiguous ranges are allowed.

<DateRangeField
  v-model="range"
  :min-value="new CalendarDate(2026, 8, 1)"
  :max-value="new CalendarDate(2026, 9, 30)"
  :maximum-days="14"
  :is-date-unavailable="(date) => closedDates.has(date.toString())"
/>

Set allowNonContiguousRanges when unavailable interior dates may be skipped conceptually. Start and end must still be available.

Fixed endpoint

Keep one known boundary read-only while users edit the other. The fixed endpoint is exposed through data-akaza-fixed-date.

<DateRangeField v-model="range" fixed-date="start" />

Locale order and paste

Both endpoints use the same locale. For en-GB, visual and focus order is day, month, year. Paste a date with three numeric groups into either endpoint.

<DateRangeField v-model="range" locale="en-GB" />

Cancel changes

Endpoint edits emit the complete proposed range before the model changes. Reasons are prefixed with start- or end-.

<DateRangeField
  v-model="range"
  @value-change="(next, details) => {
    if (next.end?.day === 20) details.cancel()
  }"
/>

Read-only and disabled

Read-only segments stay focusable for inspection. Disabled segments leave the tab sequence and both endpoint values are excluded from form submission.

<DateRangeField :model-value="range" read-only />
<DateRangeField :model-value="range" disabled />

Reactive validation

Controlled value and constraint changes update native validity. Partial endpoints count toward range validity. A canceled form reset keeps both drafts.

API Reference

Model

ModelTypeDefaultDescription
v-modelCalendarDateRange{}Optional start and end date values. Partial segment text remains internal.

Props

PropTypeDefaultDescription
idstringField/generated idID assigned to the first start segment.
namestringField nameBase native form name used to create .start and .end names.
startNamestring${name}.startExplicit start form field name.
endNamestring${name}.endExplicit end form field name.
localestring"en-US"Segment order, separators, and accessible labels for both endpoints.
dir"ltr" | "rtl""ltr"Reading direction and segment arrow behavior.
placeholderCalendarDateValuetodayDate context used while endpoint segments are partial.
minValueCalendarDateValue-Earliest valid start and endpoint value.
maxValueCalendarDateValue-Latest valid end and endpoint value.
isDateUnavailable(date) => boolean-Application rule for unavailable dates.
allowNonContiguousRangesbooleanfalseAllows unavailable dates inside, but not at boundaries.
maximumDaysnumber-Maximum inclusive range length.
fixedDate"start" | "end"-Makes one endpoint read-only.
requiredbooleanfalseRequires both endpoints for native validity.
disabledbooleanfalseDisables editing and native form participation.
readOnlybooleanfalseKeeps segments focusable but blocks changes.
invalidbooleanfalseForces invalid styling and ARIA state.
selectOnFocusbooleantrueSelects focused segment text.
autoAdvancebooleantrueAdvances after a segment reaches full length.
startLabelstring"Start date"Accessible label for the start Date Field.
endLabelstring"End date"Accessible label for the end Date Field.
ariaLabelstring"Date range"Root group label without an external label.
ariaLabelledbystringField label IDExternal label relationship.
ariaDescribedbystringField description/error IDsExternal description relationship.
uiDateRangeFieldUi-Classes for generated structural parts.

Emits

EventPayloadDescription
update:modelValueCalendarDateRangeFires after an accepted endpoint change or clear.
value-change(range, details)Fires before model changes. details.cancel() prevents the change.
value-commit(range, details)Fires after accepted endpoint input, keyboard, paste, or blur commits.

Slots

SlotPropsDescription
start-literalvalueReplaces locale separators inside the start endpoint.
separator-Replaces the visual separator between endpoints.
end-literalvalueReplaces locale separators inside the end endpoint.

Methods

MethodDescription
focusStart()Focuses first locale-ordered start segment.
focusEnd()Focuses first locale-ordered end segment.
clear(event?)Requests an empty range through cancelable change flow.
setValue(value, reason, event?)Requests an imperative range change.

UI Options

KeyDescription
rootRange group root.
startStart endpoint wrapper.
startFieldNested DateFieldUi for start segments.
separatorEndpoint separator.
endEnd endpoint wrapper.
endFieldNested DateFieldUi for end segments.
hiddenInputAggregate native validity input.

Styling Hooks

UI keyCSS classData attrs
rootakaza-date-range-fielddata-akaza-state="empty|partial|complete", data-akaza-fixed-date, data-akaza-disabled, data-akaza-readonly, data-akaza-required, data-akaza-invalid, data-akaza-dirty, data-akaza-touched, data-akaza-filled, data-akaza-focused
startakaza-date-range-field-startdata-akaza-endpoint="start", data-akaza-state="empty|filled"
separatorakaza-date-range-field-separator-
endakaza-date-range-field-enddata-akaza-endpoint="end", data-akaza-state="empty|filled"
hiddenInputakaza-date-range-field-hidden-inputnative validity attrs

Nested endpoint parts retain Date Field's exact semantic classes and data attributes. Plain class applies to the Date Range Field root; use ui.startField and ui.endField for generated segment internals.

Keyboard

Each endpoint follows Date Field keyboard behavior. Tab moves through start segments, then end segments. Root uses role="group"; each date segment remains a labeled role="spinbutton".