React Calendar Toolkit
Edit page
OverviewGetting startedDatepickerDescriptionPropsCustomizationDatepicker attached to the inputChange visual theme
Customize UI
Utilities

Description

Datepicker is a component which allows user to see and pick from Calendar of provided dates. It contains:

  • Header with selected date and Datepicker title.
  • Selector, which allows switching between precisions and step between months.
  • Day, Month and Year calendars.

Props

initialDate
Class(Date)
new Date(2020, 0, 6)
today
Class(Date)
new Date(Date.now())
startDate
Class(Date)
new Date(2020, 0, 1)
endDate
Class(Date)
new Date(2020, 1, 25)
showHeader
bool
true
title
string
[Empty string]
minPrecision
'year' │ 'month' │ 'day'
'day'
onDateSet
func
required
wrapperClassName
string
[Empty string]
renderDayAs
elementType
Day
dayCalendarClassName
string
[Empty string]
renderMonthAs
elementType
Month
monthCalendarClassName
string
[Empty string]
renderYearAs
elementType
Year
yearCalendarClassName
string
[Empty string]
renderWeekdaysAs
elementType
Weekdays
renderHeaderAs
elementType
HeaderUI
renderSelectorAs
elementType
SelectorVisual
disableDate
func
({isWeekend, precision, date}) => false
highlightDate
func
({isWeekend, precision, date}) => false
highlightWeekends
bool
true
dateFnsLocale
{}
theme
{}

Customization

No header

Disable weekend highlight

With custom locale

You can provide any locale included in date-fns or create a custom one. First day of the week is defined inside locale object, see locale.options.weekStartsOn.

Disable and highlight dates

You can disable (custom style and non-clickable) or highlight (custom style) any rendered date.

Define minimal precision of Calendar

Setting minPrecision prop allows defining what kind of date user is able to select. E.g. if minPrecision === 'month'', user can select only between months and years. Read more.

Override CSS wrapper class name

You can override wrapping className of Datepicker with wrapperClassName prop.

<Datepicker wrapperClassName="foo" />