Skip to content

Time picker ​

hx-time-picker is a time field that opens a time row (hour, minute, optionally second and AM/PM), or with [inline]="true" the time row alone. The value is a Date that is today at the chosen time (HxTimePickerValue, Date | null); clearing the field gives null. It works with ngModel, reactive forms (including disable()) and signal forms ([formField]).

html
<hx-time-picker inputId="alarm" hourFormat="12" showIcon showButtonBar [(ngModel)]="alarm" />
<hx-time-picker [showMinutes]="false" [(value)]="opens" />
<hx-time-picker inline [stepMinute]="15" ariaLabel="Start" [(value)]="start" />
InputTypeDefaultDescription
hourFormat'24' | '12''24''12' shows hours from 1 to 12 and an AM/PM column.
showMinutesbooleantrueA minutes column; false picks the hour only (minutes and seconds are 0).
showSecondsbooleanfalseA seconds column (ignored without showMinutes).
stepHour, stepMinute, stepSecondnumber1Step of the arrow keys and buttons of a column.
minTime, maxTimeDateEarliest and latest time of day; only the time of the dates counts. A time outside moves to the nearest limit, typed text outside is dropped.
placeholder, inputIdstringOf the text field.
showIconbooleanfalseA clock button at the end of the field.
showButtonBarbooleanfalseNow and Clear buttons under the time row of the popup.
inlinebooleanfalseShows the time row in the page, with no field.
dateFormatIntl.DateTimeFormatOptionsnumeric hh:mmFormat of the text in the field.
localestringthe browser'sA BCP 47 tag for the format and the AM/PM names.
hourLabel, minuteLabel, secondLabel, periodLabel, timeLabelstringHour, Minute, Second, AM/PM, TimeAccessible names of the columns and the row.
nowLabel, clearLabel, chooseLabelstringNow, Clear, Choose timeText of the button bar; name of the button and the popup.
disabled, invalidbooleanfalse
ariaLabel, ariaLabelledbystringName of the field (or of the inline row) and the popup.
  • Field: it shows the value with Intl.DateTimeFormat. Typing parses 14:30, 14:30:05, 2:30 PM or, with [showMinutes]="false", 14 or 2 PM; Enter or leaving the field commits it, an unreadable time puts the value back.
  • Popup: click, the button, Arrow Down or Alt+Arrow Up open it; it is a non-modal dialog that stays open until Escape, the focus leaving the control or a button of the button bar. Focus moves to the first column and returns to the field on close.
  • Value: a column change gives today at that time (the day of a value set from outside is replaced). Time zones are not handled: the value is a local Date.
  • Accessibility: each column is a role="spinbutton" (aria-valuenow, aria-valuetext): Arrow Up and Down change it by the step, Page Up and Page Down by a larger step, Home and End go to the first and last value. The arrow buttons are not in the tab order.

Tokens ​

The look comes from the design tokens --h-datepicker-* and --h-inputtext-* (see Theming); override them in your theme, never the component CSS.

Part of @gravionlabs/helix-ui; all components are listed in the component reference.

Released under the MIT licence.