DevExtreme v24.2 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

React Calendar - Multiple Selection

This demo applies different selection modes and date availability options to the Calendar component.

To give you the ability to edit code on the fly, the demo uses SystemJS. For this reason, launching the demo takes some time. We strongly recommend that you do not use this approach in real projects.
Backend API

Selection Modes

The selected value or values are stored in the value property. The following selection modes are available:

  • 'single'
    A user can select only a single date at any given time.

  • 'multiple'
    A user can select multiple dates simultaneously.

  • 'range'
    A user can select a range of dates. The first and the last date in the range are stored in the value property.

If you enable selectWeekOnClick in 'multiple' or 'range' modes, users can select a week by clicking on the week number.

Disable and Clear Dates

Use the min and max properties to specify the range of available dates. In this demo, these properties limit the range to three days before and after the current date. Enable the "Set minimum date" and "Set maximum date" checkboxes to apply the properties.

If you need to disable specific dates, use the disabledDates property. Toggle the "Disable weekends" checkbox to see how this setting affects component behavior. You can specify either an array of predefined dates or a function that determines whether a date is available.

When using 'multiple' and 'range' selection modes, the behavior of disabled dates in the Calendar is as follows:

  • If you specify the value property programmatically, disabled dates are selected in the values array.

  • If you use the UI to change selection (click on dates or weeks, the Enter key), you cannot select disabled dates in 'multiple' mode. In 'range' mode, disabled dates cannot start or end a range, but can be included in the middle.

To clear selected values, call the Calendar clear() method.