datui
Color scheme

Forms

DateRangeInput

Segmented start – end date field with a range calendar popover.

import { DateRangeInput } from "datui";

Playground

<DateRangeInput closeOnChange status="default" />

Examples

Basic

Check-in – check-out

Accessibility

  • One role="group" holding six labelled spinbutton segments ("Start day" … "End year"); name the group with aria-label or aria-labelledby.
  • Keys work as in DateInput; Left/Right and Backspace cross between the start and end segments. A typed end before the start is swapped.
  • The range calendar opens in a focus-trapped dialog and closes once both ends are chosen (with closeOnChange); focus returns to the calendar button.

API

DateRangeInput

Segmented start – end date field (DD.MM.YYYY – DD.MM.YYYY) with a range calendar popover. Keys work as in DateInput; Left/Right and Backspace cross between the two ends.

PropTypeDefaultDescription
afterReactNode—Content after the control, e.g. an icon, clear button or unit.
beforeReactNode—Content before the control, usually an icon.
calendarLabelstringCalendar
calendarPlacementPlacementbottom-start
changeEndDayLabelstringEnd day
changeEndMonthLabelstringEnd month
changeEndYearLabelstringEnd year
changeMonthLabelstring"Month"
changeStartDayLabelstringStart day
changeStartMonthLabelstringStart month
changeStartYearLabelstringStart year
changeYearLabelstring"Year"
classNamestring—
clearFieldLabelstringClear
closeOnChangebooleantrueClose the calendar once both ends are picked.
defaultValueCalendarRangeValuenull
disableCalendarbooleanfalse
disabledboolean—
disableFutureboolean—
disablePastboolean—
namestring—Form field name; hidden inputs submit `<name>[start]` and `<name>[end]` ISO strings.
nextMonthLabelstring"Next month"
onCalendarOpenChange((open: boolean) => void)—
onChange((value: CalendarRangeValue) => void)—Called with `[start, end]` (either may be `null`); a typed end before the start is swapped.
prevMonthLabelstring"Previous month"
readOnlyboolean—
shouldDisableDate((date: Date) => boolean)—
showCalendarLabelstringShow calendar
statusFormFieldStatus"default"Visual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this).
valueCalendarRangeValue—
weekStartsOn0 | 1 | 4 | 2 | 3 | 5 | 61