Use the calendar view for both mobile and desktop or set it up responsively. The main difference between the two rendering modes - controlled by the touchUi setting - is how the calendar is laid out.
When set to false the component shows up suitable for larger screens and pointer interaction while setting it to true renders it suitable for touch screens.
Different display modes can be used for mobile and desktop.
On mobile, the calendar can be rendered at the top or bottom of the screen, in the center of the screen,
anchored to an input or any object for that matter and it can also be embedded in any inline content.
Set up the Calendar to behave responsively. Use the appriopriate positioning and rendering based on the screen size.
You can have a bottom positioned calendar on mobile, a popover anchored to the input on tablet and desktop display on large sceens.
All this can be configured under the responsive setting where you pass the options for each breakpoint.
Use the calendar for single and multiple day selection for both desktop and mobile. Link the calendar to any field - plain HTML or styled input - or embed it right into a page. Navigate the months with the arrows or by swiping.
When linked to an input, the calendar will automatically open on focus and click. You can turn it off and only show it on a button click.
You can select entire weeks instead of single days. This is useful when users need to select a full week instead of a variable range. It can be activated with selectType: 'week'. Single or multiple weeks can be selected based on the select: 'single','multiple' or integer setting.
You can also control the day the week starts with the firstDay setting.
The calendar view supports variable weeks. Save space by only displaying one or two weeks or go for a full month where it makes sense.
Use the weeks setting that expects a number of rows. The default is six weeks, but feel free to play around.
While the calendar supports variable week views there are cases when you don't want to commit to a single setup. Get the best of both worlds by dynamically letting the users switch between a week-view and a full month-view.
Use the compact week-view to save space and programatically switch to a month-view when users need the full context of a month.
Use the min and max settings to restrict selection.
This is useful to make picking a date faster and to reduce user errors.
A great example is scheduling. You want to disable past dates and maybe enable selection from the next six months. Simply restrict values with the min and max.
Disable dates with the invalid setting. It supports exact dates, ranges, recurring dates and weekdays.
Time can also be invalidated by passing exact values and ranges.
Using invalids is essential to a great UX. First make sure you have the min & max values right and then work your way back to invalids.
If you would like to re-enable dates inside an invalid range, you can do it with the valid setting.
Having it set up correctly not just enhances the UX, but improves performance.
Book single or multiple appointments depending on the use-case or set up recurring date and time selection. Limit the available dates with the min and max settings. Make dates un-selectable with the invalid setting.
Load additional information in labels that helps people book the appointment. This can be pricing, available spots or anything you would like. You can show it as labels, mark days or color days. It can be loaded on demand from an external API like in this example.
A great example for a recurring booking is resource allocation. Take the booking of a basketball court for two hours ever Wednesday from 8PM. The example below lets you select a day of a week and an available time (served with two hour increments) and then it colors the days in a recurring manner for visibility.
You can add these with exact dates, ranges, days of week, days of month and recurring dates.
When processing a lot of data you can load the marked days, labels, colors dynamically in the onPageChange event.
Enable week numbers with the weekCounter setting. Counting yearly and monthly are both supported.
Use it whenever it is important to users having the week number in front of them. With weekCounter: 'year' you can start the counter from the first until the last week of the year. weekCounter: 'month' restarts the counter for every month.
Values can change a couple different ways: though defaults, intracting with the UI or programatically. The calendar defaults to now, which can be easily overridden with the defaultValue setting.
Values are set by interacting with the component and making a selection or it can be done programatically with the setVal method.
Use the buttons setting for showing/hiding set, cancel, clear, now or add custom buttons.
Shipping with full RTL support, choose left-to-right or right-to-left with the rtl setting.
The value is inherited from the localization settings and can be manually overriden by explicitly setting it true or false.
The components are fully localized.
In case of the calendar this covers date and time format, button copy, rtl and more.
You can see how each example shows up by clicking on the small flag icon or checking the examples below.
The calendar ships with different event hooks for deep customization. Events are triggered through the lifecycle of the component where you can tie in custom functionality and code.
While users interact with the UI events like onChange, onSet, onInit ... will be triggered.
Interact with the example and check the event log for the output.