Skip to content

DatePickerInput

DatePickerInput is a form-field component — a locale-aware segmented input (day / month / year) that opens a calendar popover. It accepts the same mode, clearable, isDateDisabled, locale, and labels props as TemporalDatePicker, plus its own input-specific props.

tsx
import { useState } from 'react'
import { Temporal } from '@js-temporal/polyfill'
import { DatePickerInput } from 'temporal-react-datepicker'

function App() {
  const [date, setDate] = useState<Temporal.PlainDate | undefined>(undefined)

  return <DatePickerInput value={date} onChange={setDate} />
}
PropTypeDefaultDescription
iconReactNode<CalendarIcon />Replace the default calendar icon.
iconPosition'left' | 'right''right'Position the icon before or after the segments.
placeholderstringlocale-derived (e.g. dd/mm/aaaa)Placeholder shown when no value is set.
disabledbooleanfalseDisables all interaction.
classNamestring''Additional CSS class on the root element.

All TemporalDatePicker shared props (mode, clearable, value, onChange, isDateDisabled, locale, labels) are also accepted. See Props reference.

The segment order and separator are derived from Intl.DateTimeFormat — no hardcoded format tables:

LocaleFormat
es-ESdd / mm / aaaa
en-USmm / dd / yyyy
en-GBdd / mm / yyyy
ja-JPyyyy / mm / dd
de-DEdd / mm / jjjj
tsx
// Explicit locale — segments reorder automatically
<DatePickerInput locale="es-ES" onChange={setDate} />

// Follows browser locale (default)
<DatePickerInput onChange={setDate} />

Pass clearable to show a × button. When cleared, onChange receives undefined.

tsx
<DatePickerInput clearable value={date} onChange={setDate} />

In range mode, two segment groups appear side-by-side separated by . Both groups share a single popover that closes automatically once start and end are selected.

tsx
import type { DateRange } from 'temporal-react-datepicker'

const [range, setRange] = useState<DateRange | undefined>(undefined)

<DatePickerInput
  mode="range"
  clearable
  value={range}
  onChange={setRange}
/>

CalendarIcon is exported separately if you want to compose it. Pass any ReactNode to icon:

tsx
import { DatePickerInput, CalendarIcon } from 'temporal-react-datepicker'

// Replace with a custom SVG
<DatePickerInput
  icon={<MyCalendarIcon />}
  onChange={setDate}
/>

// Icon on the left
<DatePickerInput
  iconPosition="left"
  onChange={setDate}
/>

// No icon
<DatePickerInput
  icon={<span style={{ display: 'none' }} />}
  onChange={setDate}
/>
tsx
<DatePickerInput disabled value={date} onChange={setDate} />
KeyAction
/ Increment / decrement the active segment. Day and month wrap around.
Tab / Shift+TabMove to the next / previous segment.
0–9Type a value directly. Auto-advances when unambiguous (e.g. 5 on day → commits 05, moves to month).
BackspaceClear the active segment.
Enter / SpaceOpen the calendar popover.
EscapeClose the calendar popover.