datui
Color scheme

Forms

DateInput

Segmented date (and optional time) field with a calendar popover.

import { DateInput } from "datui";

Playground

<DateInput closeOnChange status="default" />

Examples

Basic

DD.MM.YYYY

Date and time

enableTime adds hour and minute segments; Done closes.

Accessibility

  • The field is a role="group"; name it with aria-label or aria-labelledby (FormItem still wires the description and aria-invalid).
  • Each segment is a role="spinbutton" with its own label and aria-valuenow/aria-valuetext. Digits fill it and advance, Up/Down step (wrapping), Left/Right move, Backspace deletes and moves back, Delete clears.
  • Impossible dates (31.02) are not emitted; onChange gets null until the segments form a valid date.
  • The calendar opens in a focus-trapped, labelled dialog with focus on the selected day; Escape or an outside click closes it and focus returns to the calendar button.
  • With name, a hidden input submits the ISO string.

API

DateInput

Segmented date (and optional time) field with a calendar popover. Type digits into DD.MM.YYYY (HH:MM) segments (they auto-advance), Left/Right move, Up/Down step, Backspace clears back. The calendar opens in a focus-trapped dialog and returns focus to its button on Escape / outside click. Give it a name with `aria-label` or `aria-labelledby` (a FormItem label cannot point at a group).

PropTypeDefaultDescription
afterReactNode—Content after the control, e.g. an icon, clear button or unit.
beforeReactNode—Content before the control, usually an icon.
calendarLabelstringCalendarAccessible name of the calendar dialog.
calendarPlacementPlacementbottom-start
changeDayLabelstringDay
changeHoursLabelstring"Hours"
changeHoursSegmentLabelstringHours
changeMinutesLabelstring"Minutes"
changeMinutesSegmentLabelstringMinutes
changeMonthLabelstring"Month"
changeMonthSegmentLabelstringMonth
changeYearLabelstring"Year"
changeYearSegmentLabelstringYear
classNamestring—
clearFieldLabelstringClear
closeOnChangebooleantrueClose the calendar after picking a day (ignored with `enableTime`; the Done button closes then).
defaultValueDatenull
disableCalendarbooleanfalseHide the calendar button.
disabledboolean—
disableFutureboolean—
disablePastboolean—
doneButtonDisabledboolean—
doneButtonTextstring"Done"
enableTimebooleanfalseAdds hour and minute segments and time pickers.
maxDateTimeDate—Latest selectable moment; also limits the time pickers on that day.
minDateTimeDate—Earliest selectable moment; also limits the time pickers on that day.
namestring—Form field name; a hidden input submits the ISO string.
nextMonthLabelstring"Next month"
onApply((value: Date | null) => void)—Called when the Done button is pressed (with `enableTime`).
onCalendarOpenChange((open: boolean) => void)—
onChange((value: Date | null) => void)—Called with a valid date once the segments form one, or `null` when cleared / incomplete.
prevMonthLabelstring"Previous month"
readOnlyboolean—
requiredboolean—
shouldDisableDate((date: Date) => boolean)—
showCalendarLabelstringShow calendar
size"s" | "m""m"
statusFormFieldStatus"default"Visual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this).
valueDate—
weekStartsOn0 | 1 | 4 | 2 | 3 | 5 | 61First day of the week, 0 = Sunday.