Tailwind CSS Datepicker - Props
The following props are available for datepicker component. These are the custom props that we've added for the datepicker component and you can use all the other native props as well.
| Attribute | Type | Description | Default |
|---|---|---|---|
modelValue |
string |
Define default date for datepicker and get current datepicker value | '12:00' |
defaultDate |
string |
Define date format for datepicker display and the returned value in modelValue. | 'D d Month, Y' |
ModelValue
The input format of modelValue for setting default selected date is ISO 8601 format(YYYY-MM-DD). Using a different string as the starting value for modelValue will give an error. Passing an empty string into modelValue will set the default date of the datepicker as today, and will also allow use of the datepicker selected date at all times.
modelValue = "2023-7-7" modelValue = "2009-12-31" modelValue = ""
Types - defaultFormat
date-format = "DD-MM-YYYY" (31-12-2000) date-format = "YYYY-MM-DD" (2000-12-31) date-format = "D d M, Y" (Sun-12-Dec-2000)