Premium accessible time picker with clock dial, quick presets, and full keyboard navigation
Elegant circular clock face for intuitive time selection with animated hand
One-click presets: Now, Morning, Noon, Afternoon, Evening
Arrow keys, Tab navigation, Home/End, and natural typing
WCAG 2.1 AA with ARIA labels, live regions, and screen reader announcements
Select start and end times for duration or scheduling
Publish time selections for cross-component filtering
<link rel="stylesheet" href="styles/time-picker.css">
<script src="javascript/time-picker.js"></script>
<!-- Basic Time Picker -->
<input type="text" data-rsl-time-picker placeholder="Select time">
<!-- 24-Hour Format -->
<input type="text" data-rsl-time-picker data-format="24">
<!-- With Presets and Min/Max Time -->
<input type="text"
data-rsl-time-picker
data-show-presets="true"
data-min-time="09:00"
data-max-time="17:00"
data-step="15">
data-rsl-time-picker are automatically initialized on page load. No JavaScript required for basic usage.
| Attribute | Type | Default | Description |
|---|---|---|---|
data-rsl-time-picker |
Flag | - | Initializes the time picker component |
data-mode |
String | single |
single or range (start/end times) |
data-format |
String | 12 |
12 (AM/PM) or 24 (military time) |
data-step |
Number | 5 |
Minute increment: 1, 5, 15, 30, or 60 |
data-min-time |
String | - | Minimum selectable time (HH:mm format) |
data-max-time |
String | - | Maximum selectable time (HH:mm format) |
data-default-time |
String | - | Initial value. Use now for current time |
data-show-presets |
Boolean | true |
Show quick preset buttons (Now, Morning, etc.) |
data-show-dial |
Boolean | true |
Show clock dial (false = list-only mode) |
data-inline |
Boolean | false |
Always visible (no popover) |
data-clearable |
Boolean | true |
Show clear button in input |
data-close-on-select |
Boolean | true |
Close picker after selection |
data-auto-apply |
Boolean | true |
Auto-apply without confirm button |
data-required |
Boolean | false |
Mark field as required |
data-disabled |
Boolean | false |
Disable the picker |
data-placeholder |
String | Select time |
Input placeholder text |
data-aria-label |
String | Select time |
Accessible label for screen readers |
data-filterbus-publish |
String | - | FilterBus key for cross-component filtering |
| Method | Parameters | Description |
|---|---|---|
RSL.TimePicker.init() |
- | Initialize all time pickers on the page |
RSL.TimePicker.create(element, options) |
element, options | Create a time picker on a specific element |
RSL.TimePicker.getValue(element) |
element | Get current value (HH:mm format) |
RSL.TimePicker.setValue(element, time) |
element, time | Set value programmatically |
RSL.TimePicker.open(element) |
element | Open the picker popover |
RSL.TimePicker.close(element) |
element | Close the picker popover |
RSL.TimePicker.clear(element) |
element | Clear the selected value |
RSL.TimePicker.destroy(element) |
element | Remove time picker and clean up |
// Create programmatically
var input = document.querySelector('#appointment-time');
RSL.TimePicker.create(input, {
format: '12',
step: 15,
minTime: '09:00',
maxTime: '17:00',
showPresets: true
});
// Get value
var time = RSL.TimePicker.getValue(input);
console.log(time); // "14:30"
// Set value
RSL.TimePicker.setValue(input, '09:30');
// Listen for changes
input.addEventListener('rsl-time-change', function(e) {
console.log('Time selected:', e.detail.time);
console.log('Formatted:', e.detail.formatted);
});
| Event | Detail | Description |
|---|---|---|
rsl-time-change |
{ time, formatted, hours, minutes, period } |
Fired when time is selected/changed |
rsl-time-open |
- | Fired when picker opens |
rsl-time-close |
- | Fired when picker closes |
rsl-time-clear |
- | Fired when value is cleared |
The Time Picker integrates with RSL's FilterBus for cross-component communication, allowing time selections to filter data in tables and other components.
The Time Picker publishes time selection to FilterBus. Other components (Smart Table, Charts, etc.) can subscribe to filter their data by time.
| Attribute | Values | Description |
|---|---|---|
data-filterbus-publish |
Filter key (string) | Publishes time selection to FilterBus with the specified key. |
The Time Picker publishes an object with the following structure:
// Time Picker publishes:
{
time: '14:30', // 24-hour format (HH:MM)
formatted: '2:30 PM', // Display format based on config
mode: 'single' // 'single' or 'range'
}
<!-- Time picker publishes to 'timeFilter' key -->
<input type="text"
data-rsl-time-picker
data-format="12"
data-step="15"
data-filterbus-publish="timeFilter">
Other components can subscribe to the time filter key to filter their data:
// Subscribe to time filter changes
RSL.FilterBus.subscribe('my-time-subscriber', function(state) {
var timeData = state.timeFilter;
if (!timeData) return;
console.log('Selected time:', timeData.time); // "14:30"
console.log('Formatted:', timeData.formatted); // "2:30 PM"
// Filter your data based on time
filterTableByTime(timeData.time);
}, { keys: ['timeFilter'] });
View the FilterBus Demo page to see the Time Picker working with Smart Tables and other components.
| Key | Action |
|---|---|
Enter / Space |
Open picker, confirm selection |
Escape |
Close picker without saving |
Tab |
Move focus between elements (trapped in popover) |
Arrow Up |
Increment current segment (hours/minutes) |
Arrow Down |
Decrement current segment |
Arrow Left |
Move to previous segment |
Arrow Right |
Move to next segment |
Home |
Jump to minimum time |
End |
Jump to maximum time |
Delete / Backspace |
Clear value (when clearable) |
:focus-visible stylesprefers-reduced-motion media queryThe Time Picker integrates with the JSON Layout API V2 for declarative, programmatic creation.
Use type: "timepicker" to create time pickers without writing HTML strings.
const config = {
version: 2,
layoutId: "meeting-scheduler",
breakpoints: { xs: 1, md: 2 },
items: [
{
content: {
type: "card",
title: "Meeting Time",
customContent: {
type: "timepicker",
format: "12",
step: 15,
placeholder: "Select time...",
minTime: "09:00",
maxTime: "17:00"
}
}
}
]
};
RSL.JSONLayout.renderLayout('#container', config);
| Property | Type | Description |
|---|---|---|
format | string | "12" or "24" - Time format |
step | number | Minute increment (1, 5, 15, 30, 60) |
mode | string | "single" or "range" |
placeholder | string | Input placeholder text |
minTime | string | Minimum time "HH:mm" |
maxTime | string | Maximum time "HH:mm" |
defaultTime | string | Initial time or "now" |
filterBusPublish | string | FilterBus key for publishing |
onChange | function | Callback: (event, value, instance) |
View Time Picker JSON API Examples for comprehensive demos including range mode, constraints, and FilterBus integration.
View examples.html for comprehensive demos
Test features in playground.html
Browse all RSL components