Options

Complete configuration options reference

Basic Options

OptionTypeDefaultDescription
amLabelstring"AM"Custom text for AM label
animationbooleantrueEnable/disable open/close animations
appendModalSelectorstring""DOM selector to append timepicker (defaults to body)
backdropbooleantrueShow/hide backdrop overlay
cancelLabelstring"CANCEL"Text for cancel button
clockType"12h" | "24h""12h"Clock format type
cssClassstringundefinedAdditional CSS class for timepicker wrapper
delayHandlernumber300Debounce delay for buttons (ms)
editablebooleanfalseAllow manual input editing
enableScrollbarbooleanfalseKeep page scroll when picker is open
enableSwitchIconbooleanfalseShow desktop/mobile switch icon
focusInputAfterCloseModalbooleanfalseFocus input after closing modal
focusTrapbooleantrueTrap focus within modal
hourMobileLabelstring"Hour"Hour label for mobile version
idstringundefinedCustom ID for timepicker instance
incrementHoursnumber1Hour increment step (1, 2, 3)
incrementMinutesnumber1Minute increment step (1, 5, 10, 15)
minuteMobileLabelstring"Minute"Minute label for mobile version
mobilebooleanfalseForce mobile version
mobileTimeLabelstring"Enter Time"Time label for mobile version
okLabelstring"OK"Text for OK button
pmLabelstring"PM"Custom text for PM label
switchToMinutesAfterSelectHourbooleantrueAuto-switch to minutes after hour selection
themeTheme"basic"UI theme (see themes section)
timeLabelstring"Select Time"Time label for desktop version

Themes

Choose from 9 built-in themes:

basic

Default Material Design theme

crane-straight

Google Crane theme with straight edges

crane-radius

Google Crane theme with rounded edges

m3

Material Design 3 (Material You)

dark

Dark mode theme

glassmorphic

Modern glass effect

pastel

Soft pastel colors

ai

Futuristic AI-inspired theme

cyberpunk

Neon cyberpunk aesthetic

const picker = new TimepickerUI(input, {
theme: 'cyberpunk'
});

Inline Mode

Display timepicker without modal overlay:

const picker = new TimepickerUI(input, {
inline: {
enabled: true,
containerId: 'timepicker-container',
showButtons: false, // Hide OK/Cancel buttons
autoUpdate: true // Auto-update input on change
}
});

Disabled Time

Disable specific hours, minutes, or time ranges:

const picker = new TimepickerUI(input, {
disabledTime: {
hours: [1, 3, 5, 8], // Disable specific hours
minutes: [15, 30, 45], // Disable specific minutes
interval: '10:00 AM - 2:00 PM' // Disable time range
// Or multiple ranges:
// interval: ['10:00 AM - 2:00 PM', '5:00 PM - 8:00 PM']
}
});

Current Time

Set current time to input and picker:

const picker = new TimepickerUI(input, {
currentTime: {
updateInput: true,
locales: 'en-US',
time: new Date()
}
});

Custom Labels

Customize all text labels:

const picker = new TimepickerUI(input, {
amLabel: 'AM',
pmLabel: 'PM',
okLabel: 'Confirm',
cancelLabel: 'Close',
timeLabel: 'Choose Time',
hourMobileLabel: 'Hour',
minuteMobileLabel: 'Minute',
mobileTimeLabel: 'Enter Time'
});

Complete Example

const picker = new TimepickerUI(input, {
// Display
theme: 'dark',
clockType: '24h',
animation: true,
backdrop: true,
// Behavior
focusTrap: true,
editable: false,
mobile: false,
enableScrollbar: false,
switchToMinutesAfterSelectHour: true,
// Labels
okLabel: 'Confirm',
cancelLabel: 'Close',
timeLabel: 'Choose Time',
// Increments
incrementHours: 1,
incrementMinutes: 5,
// Restrictions
disabledTime: {
hours: [0, 1, 2, 3],
interval: '12:00 PM - 1:00 PM'
},
// Current time
currentTime: {
updateInput: true,
time: new Date()
},
// Custom ID
id: 'my-timepicker',
// Custom class
cssClass: 'custom-picker'
});