Homelogologo
Sponsor

DateInput

A segmented date input that lets users enter date values field by field.

Usage

A compound component that provides an accessible, segmented interface for entering dates. Each part of the date (month, day, year) is an independently focusable and editable segment.

import { DateInput } from "@elemnts-ui/react"; <DateInput> <DateInput.Label>Date</DateInput.Label> <DateInput.Control> <DateInput.SegmentGroup> <DateInput.Context> {(api) => api.segments.map((segment, idx) => ( <DateInput.Segment key={idx} segment={segment} /> )) } </DateInput.Context> </DateInput.SegmentGroup> <DateInput.HiddenInput /> </DateInput.Control> </DateInput>;

Disabled

Set the disabled prop to prevent interaction with the date input.

With Field

Use DateInput inside a Field component to add a label, helper text, and validation states with proper accessibility wiring.

API Reference

DateInput

The root component that manages the date input state and accessibility behavior.

PropTypeDefault
allSegmentsPartial<{ year: boolean; month: boolean; day: boolean; hour: boolean; minute: boolean; second: boolean; dayPeriod: boolean; era: boolean; literal: boolean; timeZoneName: boolean; weekday: boolean; unknown: boolean; fractionalSecond: boolean }>-
asChildbooleanfalse
createCalendar(identifier: CalendarIdentifier) => Calendar-
defaultPlaceholderValueDateValue-
defaultValueDateValue[]-
dir"ltr" | "rtl""ltr"
disabledbooleanfalse
formstring-
format(date: DateValue, details: FormatDateDetails) => string-
formatterDateFormatter-
getRootNode() => ShadowRoot | Node | Document-
granularityDateGranularity"day"
hideTimeZonebooleanfalse
hourCycleHourCycle-
idstring-
idsPartial<{ root: string; label: (index: number) => string; control: string; segmentGroup: (index: number) => string; hiddenInput: (index: number) => string }>-
invalidbooleanfalse
isDateUnavailable(date: DateValue, locale: string) => boolean-
localestring"en-US"
maxDateValue-
minDateValue-
namestring-
onFocusChange(details: FocusChangeDetails) => void-
onPlaceholderChange(details: PlaceholderChangeDetails) => void-
onValueChange(details: ValueChangeDetails) => void-
placeholderValueDateValue-
readOnlybooleanfalse
requiredbooleanfalse
selectionModeSelectionMode"single"
shouldForceLeadingZerosbooleanfalse
timeZonestring"UTC"
translationsIntlTranslations-
valueDateValue[]

DateInputRootProvider

Provides an externally created date input API to the component tree.

PropTypeDefault
valueDateInputApi<PropTypes>required
asChildbooleanfalse

DateInputLabel

The accessible label for the date input.

PropTypeDefault
asChildbooleanfalse

DateInputControl

Wraps the segment group and hidden input.

PropTypeDefault
asChildbooleanfalse

DateInputSegmentGroup

Groups the focusable date segments.

PropTypeDefault
asChildbooleanfalse
indexnumber-

DateInputSegment

A single editable or literal segment of the formatted date.

PropTypeDefault
segmentDateSegmentrequired
asChildbooleanfalse

DateInputHiddenInput

A hidden native input used for form submission.

PropTypeDefault
asChildbooleanfalse
indexnumber-

DateInputContext

Provides the date input API to a render function.

DateInputSegmentContext

Provides the current segment API to a render function.