DateInput
Free form date input
Source
LLM docs
Docs
PackageIcon
DatePicker props
DateInput supports most of the DatePicker props.
Read through the DatePicker documentation to learn about all component features that are not listed on this page.
Usage
Value format
Use the valueFormat prop to change the dayjs format of the value label.
To use some custom formats, you need to enable the custom parse format plugin:
Example of using DateInput with a custom format:
Date parser
Use the dateParser prop to replace the default date parser. The parser function accepts user input (string)
and must return a Date object:
Allow clear
Set the clearable prop to allow removing the value from the input. The input will be cleared if the
user selects the same date in the dropdown or clears the input value:
Clear section mode
The clearSectionMode prop determines how the clear button and rightSection are rendered:
'both'(default) – render both the clear button andrightSection'rightSection'– render only the user-suppliedrightSection, ignore clear button'clear'– render only the clear button, ignorerightSection
Min and max date
Set the minDate and maxDate props to define minimum and maximum dates. If a date that is after maxDate
or before minDate is entered, it will be considered invalid and the input value will be reverted
to the last known valid date value.
Disabled state
Input props
DateInput component supports Input and Input.Wrapper component features and all input element props. The DateInput documentation does not include all features supported by the component – see the Input documentation to learn about all available features.
Input description
Get element ref
Accessibility
If DateInput is used without the label prop, it will not be announced properly by screen readers:
Set aria-label to make the input accessible. In this case the label will not be visible, but screen readers will announce it:
If the label prop is set, the input will be accessible and it is not required to set aria-label: