Time Input
<cs-time-input>
Time pickers let users enter a time through a segmented field or select one visually from a popup column picker. They support 12- and 24-hour formats, optional seconds, and locale-aware segment order.
Time Input is the time-of-day counterpart to Date Input. It renders a segmented input with hour, minute, optional seconds, and optional AM/PM spinbutton segments in the user’s locale order, alongside a popup column picker modeled on Chrome’s native time UI.
Type digits to fill the focused segment (focus auto-advances when a segment can accept no further digit), use the arrow keys to step through values, and press Alt+Down Arrow to open the popup. The entire segmented input is one tab stop.
Form Submission
The hidden form value is canonical 24-hour time, regardless of the user’s locale or hour-format:
| Input | Form value | Notes |
|---|---|---|
| Whole-minute steps (default) | HH:mm | step="60" or any multiple; e.g. 14:30 |
| Sub-minute steps | HH:mm:ss | When step < 60 and the seconds segment shows; e.g. 14:30:15 |
| 12-hour UI | 24-hour | 2:30 PM submits as 14:30 |
| Partial input | (empty) | Until every required segment is filled |
The example below renders a working form. Submit it (or change the time) and watch the console. The time input submits its value just like a native <input type="time">, regardless of how the user typed or what locale they used.
Examples
Initial Value
Set the value attribute to a time string to pre-populate the input.
Label
Use the label attribute to give the time input an accessible label. For labels that contain HTML, use the label slot instead.
Hint
Add descriptive hint to a time input with the hint attribute. For hints that contain HTML, use the hint slot instead.
Start & End Decorations
Use the start and end slots to add presentational elements like <cs-icon> inside the input.
Clearable
Add the with-clear attribute to let users wipe their selection in a single click. The clear button only appears once a value is set.
Min & Max
Constrain the selectable range. The picker delegates reversed-range (overnight) semantics to the native <input type="time">, so min="22:00" max="06:00" represents an overnight range.
Step
The step attribute is in seconds, matching the HTML spec. The default is 60 (one minute). Set step below 60 to expose a seconds segment; set it to a multiple of 60 to populate the minute column at that stride.
12-Hour vs 24-Hour
By default, hour-format="auto" follows the resolved locale. Pass hour-format="12" or hour-format="24" to override.
Localized
The segment order, separators, and AM/PM strings all derive from the page’s locale. Set the lang attribute on the host (or an ancestor) to change locales.
“Now” Button
Add a quick-pick “Now” button in the popup footer with with-now.
Size
Use the size attribute to match the time input to surrounding form controls.
Appearance
Use the appearance attribute to switch between the default outlined input, a filled background, or a filled input with an outlined border.
Pill
Use the pill attribute to give the input fully rounded edges.
Disabled
Use the disabled attribute to disable the time input entirely. Disabled time inputs don’t accept input, are skipped during tabbing, and don’t submit a value with the form.
Readonly
Use the readonly attribute to make the time input non-editable while still allowing it to be focused and to submit its value with the form. The popup still opens for browsing.
API
Importing
If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick this component, use one of the following snippets.
import '@cruglobal/cornerstone-components/components/time-input/time-input.js';
import './cornerstone/components/time-input/time-input.js';
import CsTimeInput from '@cruglobal/cornerstone-components/react/time-input/index.js';
Slots
Learn more about using slots.
| Name | Description |
|---|---|
clear-icon | An icon to use in lieu of the default clear icon. |
end | An element placed at the end of the input. |
expand-icon | The icon to show on the popup toggle button. Defaults to a clock icon. |
footer | Content shown below the column picker in the popup. Replaces the default Now button when present. |
hint | Text that describes how to use the time picker. Alternatively, use the hint attribute. |
label | The time picker's label. Alternatively, use the label attribute. |
start | An element placed at the start of the input. |
Attributes & Properties
Learn more about attributes and properties.
| Property | Attribute | Description | Type | Default | Reflects |
|---|---|---|---|---|---|
appearance | appearance | The time picker's visual appearance. | 'filled' | 'outlined' | 'filled-outlined' | 'outlined' | Yes |
assumeInteractionOn | — | Every segment edit dispatches input, so a single observed input event marks the field as interacted with. | string[] | ['input'] | — |
autocomplete | autocomplete | Forwarded to the hidden form input to enable browser autofill (on/off/custom tokens). | string | '' | — |
defaultValue | value | The default value of the form control. Used for form reset. | string | — | Yes |
disabled | disabled | Disables the time picker. | boolean | false | — |
distance | distance | Distance in pixels between the popup and the input. | number | 0 | Yes |
form | — | By default, form controls are associated with the nearest containing <form> element. This attribute allows you to place the form control outside of a form and associate it with the form that has this id. The form must be in the same document or shadow root for this to work. | HTMLFormElement | null | — | — |
hint | hint | The time picker's hint. If you need to display HTML, use the hint slot instead. | string | '' | — |
hourFormat | hour-format | Whether the UI uses a 12-hour or 24-hour clock. auto follows the resolved locale. | CsTimeInputHourFormat | 'auto' | Yes |
label | label | The time picker's label. If you need to display HTML, use the label slot instead. | string | '' | — |
max | max | The latest selectable time in wire format. | string | '' | Yes |
min | min | The earliest selectable time in wire format. May be later than max to represent an overnight range. The picker delegates reversed-range semantics to the mirrored native <input type="time">. | string | '' | Yes |
name | name | The time picker's name, submitted as a name/value pair with form data. | string | null | '' | Yes |
open | open | Whether the popup is open. | boolean | false | Yes |
pill | pill | Draws a pill-style time picker with rounded edges. | boolean | false | Yes |
placement | placement | Preferred popup placement. | CsTimeInputPlacement | 'bottom-start' | Yes |
readonly | readonly | Makes the input non-editable. The popup still opens for browsing. | boolean | false | Yes |
required | required | Makes the time picker required for form submission. | boolean | false | Yes |
size | size | The time picker's size. | CsTimeInputSize | 'm' | Yes |
ssrFooter | ssr-footer | Only required for SSR. Set to true if you're slotting in a footer element. | boolean | false | — |
ssrHint | ssr-hint | Only required for SSR. Set to true if you're slotting in a hint element. | boolean | false | — |
ssrLabel | ssr-label | Only required for SSR. Set to true if you're slotting in a label element. | boolean | false | — |
step | step | The granularity, in seconds, matching HTML <input type="time">. Default 60 hides the seconds segment. Values below 60 reveal the seconds segment. 'any' disables stepMismatch enforcement. | number | 'any' | 60 | — |
validationTarget | — | Override this to change where constraint validation popups are anchored. | undefined | HTMLElement | — | — |
validators | — | Validators are static because they have observedAttributes, essentially attributes to "watch" for changes. Whenever these attributes change, we want to be notified and update the validator. | Validator[] | [] | — |
value | — | The time picker's value as a wire-format string matching HTML <input type="time">: HH:mm, HH:mm:ss, or HH:mm:ss.sss (always 24-hour). The setter also accepts a Date (extracts local h/m/s) or null. | string | — | — |
valueAsDate | — | The time as a Date (today + wire value), or null when empty. | Date | null | — | — |
valueAsNumber | — | Milliseconds since midnight, or NaN when empty. | number | — | — |
withClear | with-clear | Shows a clear button when the time picker has a value. | boolean | false | — |
withNow | with-now | Renders a "Now" button in the popup footer. | boolean | false | — |
Methods
Learn more about methods.
| Name | Description | Arguments |
|---|---|---|
blur() | Removes focus from the time picker. | — |
focus() | Sets focus on the first empty (else first) segment. | options: FocusOptions |
formStateRestoreCallback() | Called when the browser is trying to restore element’s state to state in which case reason is "restore", or when the browser is trying to fulfill autofill on behalf of user in which case reason is "autocomplete". In the case of "restore", state is a string, File, or FormData object previously set as the second argument to setFormValue. | state: string | File | FormData | null |
hide() | Closes the popup. | — |
resetValidity() | Reset validity is a way of removing manual custom errors and native validation. | — |
setCustomValidity() | Do not use this when creating a "Validator". This is intended for end users of components. We track manually defined custom errors so we don't clear them on accident in our validators. | message: string |
show() | Opens the popup. | — |
Events
Learn more about events.
| Name | Description |
|---|---|
blur | Emitted when the control loses focus. |
change | Emitted when the committed value changes. |
cs-after-hide | Emitted after the popup closes and animations complete. |
cs-after-show | Emitted after the popup opens and animations complete. |
cs-clear | Emitted when the clear button is activated. |
cs-hide | Emitted when the popup is about to close. Cancelable. |
cs-invalid | Emitted when the form control has been checked for validity and its constraints aren't satisfied. |
cs-show | Emitted when the popup is about to open. Cancelable. |
focus | Emitted when the control receives focus. |
input | Emitted as the user types into a segment or interacts with the popup columns. |
CSS Custom Properties
Learn more about CSS custom properties.
| Name | Description | Default |
|---|---|---|
--column-item-height | Height of each option inside a popup column. | 2.25em |
--column-width | Width of each popup column. | 3em |
--hide-duration | The duration of the hide animation. | var(--cs-transition-fast) |
--show-duration | The duration of the show animation. | var(--cs-transition-fast) |
Custom States
Learn more about custom states.
| Name | Description | CSS selector |
|---|---|---|
blank | The time picker has no committed value. | :state(blank) |
disabled | The time picker is disabled. | :state(disabled) |
open | The popup is open. | :state(open) |
CSS Parts
Learn more about CSS parts.
| Name | Description | CSS selector |
|---|---|---|
clear-button | The clear button. | ::part(clear-button) |
column | Each column listbox. | ::part(column) |
column-day-period | The AM/PM column listbox. | ::part(column-day-period) |
column-hour | The hour column listbox. | ::part(column-hour) |
column-item | Each option inside a column. | ::part(column-item) |
column-item-selected | The currently selected option inside a column. | ::part(column-item-selected) |
column-minute | The minute column listbox. | ::part(column-minute) |
column-second | The second column listbox. | ::part(column-second) |
columns | The row of column listboxes inside the popup. | ::part(columns) |
end | The container that wraps the end slot. | ::part(end) |
expand-button | The popup toggle button. | ::part(expand-button) |
expand-icon | The expand icon wrapper. | ::part(expand-icon) |
form-control | The form control that wraps the label, input, and hint. | ::part(form-control) |
form-control-input | The input's wrapper. | ::part(form-control-input) |
form-control-label | The label. | ::part(form-control-label) |
hint | The hint's wrapper. | ::part(hint) |
input | The segmented input group. | ::part(input) |
input-wrapper | The container around the start slot, segmented input, clear button, and expand button. | ::part(input-wrapper) |
now-button | The default "Now" button rendered in the popup footer when with-now is set. | ::part(now-button) |
popup | The popup container. | ::part(popup) |
segment | Each editable segment (hour/minute/second/AM-PM spinbutton). Use [part~="segment"] to style all. | ::part(segment) |
segment-literal | Inert literal text between segments (separators). | ::part(segment-literal) |
start | The container that wraps the start slot. | ::part(start) |
time-input | The component's outer wrapper. | ::part(time-input) |
Dependencies
This component automatically imports the following elements. Sub-dependencies, if any exist, are included in this list.

