Skip to content
Devix Open Source

Reference

Options, methods and events

Options

Option Type Default What it does
value "HH:mm" the input's own value The starting time.
min / max "HH:mm" 00:00 / 23:59:59 The ends of the day.
step number 15 Minutes between the times on offer.
seconds boolean false Show and take seconds.
disabled TimeMatcher[] — Times that cannot be picked. See below.
enabled TimeMatcher[] — The only times that can be. disabled still overrides it.
slots SlotInput[] — The list given outright, for booking.
panel 'list' | 'columns' | false by step One column of times, or hours and minutes side by side.
locale string the page's lang, else the device's Which locale writes the time.
hourCycle 'h11' | 'h12' | 'h23' | 'h24' the locale's A 12- or 24-hour clock.
zones string[] — Other clocks to read the time on.
timeZone string the device's The zone the chosen time is in.
date "YYYY-MM-DD" today The date those conversions happen on.
footer boolean true Now and Clear.
typing boolean true Take typed text.
closeOnSelect boolean true Close after a pick.
inline HTMLElement — Render always-open into this element.
name string the input's own Name for the hidden field.
sheet 'auto' | boolean 'auto' Bottom sheet on small touch screens.
theme 'light' | 'dark' | 'auto' 'auto' auto follows the page.
classNames Partial<Record<ClassPart, string>> — Your classes on any part.
icons { clock, check } — Your own SVG.
strings Partial<TimePickerStrings> the registered pack, else English Every word it says, and the words it reads.
onChange (value, picker) => void — When the time changes.

Range only

Option Type What it does
endInput HTMLInputElement The second field. Required.
minDuration / maxDuration number Minutes. Ends that break either are struck out.
overnight boolean Let the range run past midnight.
onChange ({ start, end }, picker) => void When either end changes.

A TimeMatcher

Three shapes, mixed freely in one array:

disabled: [
  '15:30',                               // one time
  ['12:00', '13:00'],                    // a span, inclusive
  ['23:00', '06:00'],                    // a span that crosses midnight
  (seconds) => seconds % 3600 !== 0,     // a rule: only on the hour
]

A Slot

{
  time: '09:30',        // or seconds since midnight
  label?: string,       // what the row says; defaults to the time
  note?: string,        // a second line: "2 left", "AED 250"
  disabled?: boolean,
  reason?: string,      // read out to a screen reader
  className?: string,
}

A bare "09:30" is a slot with nothing else on it.

Methods

picker.getValue();          // "14:30" — or { start, end } for a range
picker.getTime();           // 52200, seconds since midnight
picker.getDuration();       // range only: seconds, counting past midnight
picker.setValue('09:15');   // or { start: '09:00', end: '17:00' }
picker.setValue('09:15', true);   // silently: no callbacks, no events
picker.getSlots();          // the rows on show, availability worked out
picker.open();
picker.close();
picker.isOpen();
picker.setOptions({ min: '10:00', slots: fresh });
picker.destroy();           // gives the page its own input back

getSlots() is the one to reach for when the times come from a server: render your own summary, count what is left, or check a time before you send it.

const free = picker.getSlots().filter((slot) => !slot.disabled);

Events

Both CustomEvents on the widget root, and both bubble:

picker.element.addEventListener('dx:timechange', (event) => {
  event.detail.value;   // "14:30" — or { start, end } for a range
});

The input the picker is mounted on also gets the native input and change events, so Livewire, Alpine, FormData, jQuery and any server-rendered form see the value with nothing wired up.

Words

Fifteen languages ship with the package, and none of them is in your bundle until you ask:

Arabic · Urdu · French · German · Spanish · Portuguese · Italian · Dutch · Turkish · Russian · Polish · Hindi · Indonesian · Chinese · Japanese

import { registerAll } from '@devix-labs/time-picker/locales';

registerAll();                                  // every language, once
createTimePicker(input, { locale: 'ar-AE' });   // now Arabic throughout

Or one, which is what most sites need — your bundler ships only what you name:

import { registerStrings } from '@devix-labs/time-picker';
import { fr } from '@devix-labs/time-picker/locales';

registerStrings('fr', fr);

A pack is 0.3–0.4 KB gzipped; all fifteen together are 3.9 KB, and the widget carries none of it. Registering is global, so <dx-time-picker locale="ar"> in markup is translated too — markup has nowhere to pass an object. fr covers fr-CA as well; register an exact tag when a country needs different wording and it wins for that country only.

Words people type

A pack also teaches the parser the words that mean a time in its language, so this works without any wiring:

// with fr registered
"midi"    → 12:00
"minuit"  → 00:00
"noon"    → 12:00   // English still parses: a pack adds to the list, it does not replace it

Your own words are added the same way, and are merged with the pack's rather than replacing them:

createTimePicker(input, {
  locale: 'ar-AE',
  strings: { words: { 'وقت الغداء': 13 * 3600 } },
});

Your own wording

strings wins over a registered pack, one key at a time:

createTimePicker(input, { locale: 'fr', strings: { now: 'À l’instant' } });

And a language nobody has written yet is one object away — a plain object is accepted as well as a function:

import { registerStrings } from '@devix-labs/time-picker';

registerStrings('sw', { now: 'Sasa', clear: 'Futa', chooseTime: 'Chagua saa' });

The complete list of keys is DEFAULT_STRINGS, exported from the package. Anything left out falls back to English rather than showing a blank button. RTL needs nothing at all: the layout uses logical properties.

Updated 15 Sep 2026