Date Picker Examples

Interactive demos showcasing all date picker features and configurations

Back to Date Picker API

Single Date Selection

The simplest form - select a single date. Perfect for birthdays, appointments, or deadlines.

No date selected
No date selected
Single Date Picker • HTML
<!-- Basic single date -->
<input type="text"
       data-rsl-date-picker
       placeholder="Click to select date">

<!-- Week starting Monday -->
<input type="text"
       data-rsl-date-picker
       data-first-day="1"
       placeholder="Week starts Monday">

Date Range Selection Popular

Select a start and end date. Ideal for booking systems, reports, and analytics.

No range selected
No range selected
Date Range Picker • HTML
<!-- Basic date range -->
<input type="text"
       data-rsl-date-picker
       data-mode="range"
       placeholder="Select start and end dates">

<!-- With quick presets -->
<input type="text"
       data-rsl-date-picker
       data-mode="range"
       data-show-presets="true"
       data-presets="today,last7,last30,thisMonth,lastMonth"
       placeholder="Choose a preset or custom range">

Multiple Date Selection

Select multiple individual dates. Great for scheduling multiple appointments or blackout dates.

No dates selected
Multiple Dates Picker • HTML
<input type="text"
       data-rsl-date-picker
       data-mode="multiple"
       placeholder="Click dates to add/remove">

Date Constraints

Restrict selectable dates with min/max dates, disabled specific dates, or disabled days of the week.

No date selected
No date selected
No date selected
Date Constraints • HTML
<!-- Today and future dates -->
<input type="text"
       data-rsl-date-picker
       data-min-date="today"
       placeholder="Today and future dates">

<!-- Future dates only (excludes today) -->
<input type="text"
       data-rsl-date-picker
       data-min-date="tomorrow"
       placeholder="Tomorrow onwards">

<!-- Disable weekends -->
<input type="text"
       data-rsl-date-picker
       data-disabled-days="0,6"
       placeholder="No weekends">

<!-- Specific date range -->
<input type="text"
       data-rsl-date-picker
       data-min-date="2025-01-01"
       data-max-date="2025-12-31"
       placeholder="2025 only">

Real-World Example: Hotel Booking

A complete booking form demonstrating practical date picker usage with constraints and presets.

Select your stay dates
Hotel Booking Form • HTML
<form id="booking-form">
    <label for="dates">Check-in / Check-out</label>
    <input type="text"
           id="dates"
           data-rsl-date-picker
           data-mode="range"
           data-min-date="today"
           data-show-presets="false"
           data-months="2"
           placeholder="Select check-in and check-out dates">

    <button type="submit">Check Availability</button>
</form>

<script>
document.getElementById('dates').addEventListener('rsl-date-change', (e) => {
    const { start, end } = e.detail.value;
    const nights = Math.ceil((end - start) / (1000 * 60 * 60 * 24));
    console.log('Nights:', nights);
});
</script>

Keyboard Navigation Demo ADA

Try navigating with your keyboard! Tab to the input, press Enter to open, then use arrow keys to navigate dates.

Tab to input, Enter to open

Keyboard Shortcuts

  • Enter/Space - Open picker or select date
  • Escape - Close picker
  • Arrow keys - Navigate days
  • Page Up/Down - Previous/next month
  • Home/End - First/last day of month
Accessible Date Picker • HTML
<!-- All accessibility features are automatic! -->
<input type="text"
       data-rsl-date-picker
       data-mode="range"
       data-show-presets="true"
       placeholder="Use keyboard to navigate">

<!-- The date picker automatically handles:
- ARIA roles and attributes
- Keyboard navigation (arrows, Page Up/Down, Home/End)
- Focus trapping within the picker
- Screen reader announcements
- Focus management on open/close
-->

JavaScript API Control

Control the date picker programmatically using the JavaScript API.

Use buttons below
JavaScript API • JavaScript
// Open the picker
RSL.DatePicker.open('#demo-api');

// Close the picker
RSL.DatePicker.close('#demo-api');

// Set a date range programmatically
RSL.DatePicker.setValue('#demo-api', {
    start: new Date('2025-01-01'),
    end: new Date('2025-01-31')
});

// Get the current value
const value = RSL.DatePicker.getValue('#demo-api');
console.log(value); // { start: Date, end: Date }

// Clear selection
RSL.DatePicker.clear('#demo-api');

// Listen for changes
document.getElementById('demo-api').addEventListener('rsl-date-change', (e) => {
    console.log('Selected:', e.detail.value);
    console.log('Formatted:', e.detail.formatted);
});

FilterBus Integration

The Date Picker can publish its selection to FilterBus for cross-component filtering. Use date ranges to filter Smart Tables, Charts, KPI Cards, and more!

Publish Date Selection

Add data-filterbus-publish="dateFilter" to your date picker to publish selections to FilterBus. Other components can subscribe to filter their data by date range.

FilterBus Example • HTML
<input type="text"
       data-rsl-date-picker
       data-mode="range"
       data-show-presets="true"
       data-filterbus-publish="dateFilter">
View FilterBus Demo API Documentation