Daterangepicker Component

The DateRangePicker component provides an input with an integrated calendar popup for selecting a date range (start and end dates). It supports date formatting, parsing, min/max date constraints, range validation, preset date ranges, and can be rendered as an inline picker or a dialog-based picker.

Usage

To import and use the Daterangepicker component in your application, use the following code snippet:

Demos

Explore the demos of the React Daterangepicker component. Refer to this page.

Props

The following table outlines the props for the Daterangepicker component:

NameTypeDefaultDescription
cellTemplate
((props: CalendarCellProps) => node)
-

Specifies a custom template for rendering the content of each calendar cell. Can be a React node or a function that returns a React node.

clearButton
boolean
true

Specifies whether to show the clear button within the input field.

depth
CalendarView.Month

Sets the most granular view the user can navigate down to. For example, a depth of Year prevents navigation to the Month view.

disableFutureDays
boolean
false

When true, disables all dates in the future relative to the current day.

disableOtherMonthNavigation
boolean
false

Prevents navigation when clicking on dates from other months in month view

disablePastDays
boolean
false

When true, disables all dates in the past relative to the current day.

disabled
boolean
false

Specifies whether the component is disabled or not.

editable
boolean
true

Specifies whether the input field can be edited directly. When false, only allows selection via calendar.

firstDayOfWeek
number
0

Specifies the first day of the week: 0 for Sunday, 1 for Monday, and so on. If not set, the first day is determined by the locale.

format
string
'MM/dd/yyyy'

Specifies the display format used in the input(s).

headerTemplate
((props: CalendarHeaderProps) => node)
-

Specifies a custom template for the calendar header. If not provided, a default header with navigation controls is rendered.

inputFormats
string[]
[ ]

Specifies acceptable input parse formats for free typing.

labelMode
'Never'

Specifies the float label behavior. Possible values:

  • Never - The label will never float.
  • Auto - The label floats when the input has focus, value, or placeholder.
  • Always - The label always floats.
maxDate
Date
new Date(2099, 11, 31)

Specifies the maximum date that can be selected in the Calendar.

maxRangeDays
number | null
-

Specifies the maximum span (in days) allowed for the range.

minDate
Date
new Date(1900, 0, 1)

Specifies the minimum date that can be selected in the Calendar.

minRangeDays
number | null
-

Specifies the minimum span (in days) allowed for the range.

open
boolean
false

Specifies whether the calendar popup is open or closed.

openOnFocus
boolean
false

When true, should open the calendar popup on input focus.

pickerIcon
node
undefined

Specifies the calendar/datepicker icon rendered in the input.

pickerVariant
PickerVariant.Auto

Specifies the display variant of the calendar popup.

  • Inline: anchored popup near the input (both desktop and mobile)
  • Dialog: centered dialog overlay (both desktop and mobile)
  • Auto: desktop = Inline, mobile = Dialog
placeholder
string
-

Specifies the placeholder text to display in the input box when no value is set.

presets
[ ]

Specifies preset shortcut ranges rendered in the popup.

readOnly
boolean
false

Specifies whether the component is in read-only mode. When enabled, users cannot change input value or open the picker.

required
boolean
false

Specifies whether the DatePicker is a required field in a form. When set to true, the component will be marked as required.

separator
string
' - '

Specifies the string separator used between start and end in single-input mode.

showDaysOutsideCurrentMonth
boolean
true

When true, shows dates from the previous and next months in the current month's view.

size
Size
Size.Medium

Specifies the size style of the Timepicker. Options include 'Small', 'Medium' and 'Large'.

start
CalendarView.Month

Specifies the initial view that the calendar renders.

strictMode
boolean
false

Enables strict date validation mode. When enabled, invalid values are prevented or auto-corrected.

valid
boolean
false

Overrides the validity state of the component. If valid is set, the required property will be ignored.

validationMessage
string
-

Controls the form error message of the component.

validityStyles
boolean
true

If set to false, no visual representation of the invalid state of the component will be applied.

variant
Variant.Standard

Specifies the visual style variant of the component.

weekDaysFormat
WeekDaysFormats.Short

Specifies the format of the day names to be displayed in the week header.

weekNumber
boolean
false

When true, displays the week number of the year in the month view.

weekRule
WeekRule.FirstDay

Specifies the rule for defining the first week of the year.

zIndex
number
1000

Sets the z-index value for the dropdown popup, controlling its stacking order relative to other elements on the page.

Events

The following table outlines the events for the Daterangepicker component:

NameTypeDescription
onChange
(value: [Date | null, Date | null]) => void

Specifies the callback fired when the value (selected date range) changes.

onClose
( ) => void

Specifies the callback fired when the popup closes.

onOpen
( ) => void

Specifies the callback fired when the popup opens.

onViewChange
(event: ViewChangeEvent) => void

Triggers when the calendar navigates to a new view or date range.