API Reference

Complete API documentation for React Calendar DateTime Picker components, types, and utilities.

Components

Both DtCalendar and DtPicker share most of their API. The props are organized into shared props (available in both components) and component-specific props.

Shared Props

These props are available in both DtCalendar and DtPicker:

DtPicker Only

These props are only available in DtPicker:

DtCalendar Only

These props are only available in DtCalendar:

Shared Props

These props are available in both `DtCalendar` and `DtPicker`:

PropTypeDefaultDescription
initValueInitValueInputundefinedInitial value for the calendar/picker
onChange(date: unknown) => voidRequiredCallback function called when the final date value changes. Receives the calculated value based on type: Day for single, Range for range/week, or Multi (Day[]) for multi. Fires AFTER onDateSelect. Use this to update your application state with the final selected value.
typeCalendarType'single'Calendar selection type
withTimebooleanfalseEnable time selection
calendarSystemCalendarSystem'gregorian'Calendar system: "gregorian" or "jalali". Also accepts shorthand aliases: "ge" for "gregorian", "ja" for "jalali"
showWeekendbooleanfalseShow weekend highlighting
todayBtnbooleanfalseShow today button
presetRangesPresetRangesConfigundefinedPreset range buttons configuration
constraintsCalendarConstraintsInputundefinedDate constraints
calenderModalClassstringundefinedCustom CSS class for calendar modal
customizationCalendarCustomizationundefinedCustomization options
numberOfMonths1 | 2 | 31Number of months to display
yearListStyle'grid' | 'list''grid'Year list style for year selection view
darkbooleanfalseEnable dark theme
onDateSelect(day: Day) => voidundefinedCallback fired immediately when a date is clicked. Receives the raw Day object that was clicked. Fires BEFORE onChange. Use this to track individual date clicks or intercept before the final value is calculated. Note: For range/multi types, this fires for each individual date click, while onChange receives the final calculated range/array.
onMonthSelect(month: number) => voidundefinedCallback when a month is selected in month view
onYearSelect(year: number) => voidundefinedCallback when a year is selected in year view
onViewChange(view: 'calendar' | 'months' | 'years') => voidundefinedCallback when the view changes (calendar, months, or years)
onMonthNavigate(direction: 'prev' | 'next') => voidundefinedCallback when navigating between months
onGoToToday() => voidundefinedCallback when the "Today" button is clicked
enlargeSelectedDaybooleantrueEnlarge selected day text in the calendar grid
dateFormatstringundefinedCustom date format string for displaying dates in the input field. Supports custom separators and order. Examples: "DD/MM/YYYY", "MM-DD-YYYY", "YYYY년 MM월 DD일". Default format is YYYY/MM/DD when not specified.
onError(errors: CalendarError[]) => voidundefinedCallback function called when normalization or constraint errors occur. Receives an array of error objects describing what failed (e.g., invalid initValue, invalid constraints).

DtPicker Only

These props are only available in `DtPicker`:

PropTypeDefaultDescription
showTimeInputbooleanfalseShow time in input field
clearBtnbooleanfalseShow clear button
isRequiredbooleanfalseMake input required
isDisabledbooleanfalseDisable the picker
placeholderstring'Select date'Placeholder text
inputClassstringundefinedCustom CSS class for input
autoClosebooleantrueAuto-close calendar after selection
inputIdstringundefinedInput element ID
triggerElementReactNodeundefinedCustom trigger element to replace the default input field. When provided, the input field will not be rendered. Useful for custom buttons, divs, or other elements.
triggerClassstringundefinedCustom CSS class for trigger wrapper when using custom trigger element

DtCalendar Only

These props are only available in `DtCalendar`:

PropTypeDefaultDescription
onCalenderChange(date: Day | Range | Multi | null) => voidundefinedCallback that runs when calendar value changes (requires initValue)