DatePicker props
DateInput supports most of the DatePicker props,
read through DatePicker documentation to learn about all component features that are not listed on this page.
Usage
Value format
Use valueFormat prop to change dayjs format of value label.
To use some custom formats, you need to enable custom parse format plugin:
Example of using DateInput with custom format:
Date parser
Use dateParser prop to replace default date parser. Parser function accepts user input (string)
and must return Date object:
Allow clear
Set clearable prop to allow removing value from the input. Input will be cleared if
user selects the same date in dropdown or clears input value:
Min and max date
Set minDate and maxDate props to define min and max dates. If date that is after maxDate
or before minDate is entered, then it will be considered invalid and input value will be reverted
to last known valid date value.
Disabled state
Input props
DateInput component supports Input and Input.Wrapper components features and all input element props. DateInput documentation does not include all features supported by the component – see Input documentation to learn about all available features.
Input description
Get element ref
Accessibility
If DateInput is used without label prop, it will not be announced properly by screen reader:
Set aria-label to make the input accessible. In this case label will not be visible, but screen reader will announce it:
If label prop is set, input will be accessible it is not required to set aria-label: