timepicker-ui
4.7.0GitHub
timepicker-ui
Features / Inline Mode

Inline Mode

Display timepicker without modal overlay

Inline with Theme

#

Apply custom theme to inline timepicker:

const picker = new TimepickerUI(input, {
ui: {
inline: {
enabled: true,
container: '#timepicker-container',
autoUpdate: true
},
theme: 'dark'
},
clock: { type: '24h' }
});
picker.create();

Embedded Card Without a Title

#

ui.inline.showTitle: false hides the title when your page already has a heading. It stays available to screen readers. New in 4.7.0.

const picker = new TimepickerUI(input, {
ui: {
inline: {
enabled: true,
container: '#timepicker-container',
embedded: true,
showTitle: false,
autoUpdate: true
}
}
});
picker.create();

Embedded in a Dialog

#

With ui.inline.embedded the picker drops its own card chrome and dialog semantics, so it can live inside your own <dialog>. The picker is created when the dialog first opens. Before 4.7.0 the clock face could not measure itself inside a hidden container, and from 4.7.0 it lays itself out when it is first shown.

Pick a time

const dialog = document.querySelector('dialog');
const input = document.querySelector('#time');
let picker = null;
openButton.addEventListener('click', () => {
dialog.showModal();
if (picker) return;
picker = new TimepickerUI(input, {
ui: {
inline: {
enabled: true,
container: '#dialog-picker',
embedded: true,
autoUpdate: true
}
}
});
picker.create();
});
Esc