DatePicker

An input to type a date, with a calendar to pick it. The text is a date in the YYYY-MM-DD format, which is the same in every country.

General

Name the field with aria-label, or with a visible label.

Initial value

Start with a date using initialValue. Use value and onChange to control it.

Min and max

A date outside the range cannot be typed, and its day is disabled in the calendar.

Disabled

Disable the input and the calendar button.

APIs

DatePicker.Props

AttributeDescriptionTypeAccepted valuesDefault
valueselected date, to control the componentDate / null--
initialValuedate at the startDate / null-null
onChangecalled with the date, or null when the text is emptied(date: Date | null) => void--
minfirst date that can be pickedDate--
maxlast date that can be pickedDate--
localelanguage of the calendarstringany Intl localeen-US
weekStartsOnfirst day of the week in the calendar, 0 is Sundaynumber0 to 60
placeholdertext shown when the input is emptystring-YYYY-MM-DD
calendarLabelname of the calendar button and of its dialogstring-Choose date
disableddisable the componentboolean-false
...native props, passed to the inputInputHTMLAttributes'aria-label', 'name', ...-

Typing

The value changes only for a real date inside min and max. 2026-02-31 is not accepted. When the input loses the focus, it goes back to the last valid date. An empty text clears the value.

Ref

The ref points at the input.

Accessibility

The calendar button has aria-haspopup="dialog" and aria-expanded. The calendar opens in a dialog with the focus on the day of the current value. Escape closes it and puts the focus back on the button, and picking a day puts the focus on the input. See Calendar for the keys.

Edit this page on GitHub