Date Picker

Component to render date picker.

Usage

The Date Picker component can be imported using

import { DatePicker } from '@tail-kit/tail-kit'

Default Date Picker

Controlled Date Picker

Date Picker with Date Range

The following example shows a Date Picker with a date range. User is only allowed to select a date within 10 days from the current date.

Weekdays Only Date Picker

Date Picker with Modal

Date Picker Props

NameDescriptionDefault Value
defaultDate
Default date selected. It can used to set a default date when using the date picker as uncontrolled component
Date | undefined
--
date
Date selected. It should be used along with `onChange` prop to set the date when using date picker as controlled component
Date | undefined
--
onChange
Callback function called when the date is changed.
OnChangeType | undefined
--
placeholder
Placeholder for empty date picker
string | undefined
Select Date
allowClear
Show clear button when a date is selected
boolean | undefined
--
startDate
Start date for the date picker. All the dates before the start date would be disabled
Date | undefined
--
endDate
End date for the date picker All the dates after the end date would be disabled
Date | undefined
--
disableDate
Function to determine whether a particular date should be disabled or not It is helpful in the cases where we want to disable dates based on a custom logic rather than range values specfied by `startDate` and `endDate` prop
((date: Date) => boolean) | undefined
--
className
Addtional classes to style date picker
string | undefined
--
style
Additional styles for date picker
CSSProperties | undefined
--