Skip to main content

TimePicker

Allows merchants to select a specific time.

string

A unique identifier for the element.

string
Default: ''

Current selected value.

The default, '', means no time is selected.

The value must be a 24-hour time in HH:mm:ss format, with leading zeros.

Examples: "00:00:00", "09:05:00", "23:59:00", "14:03:30".

This follows the HTML time input value format, which is always 24-hour with leading zeros regardless of UI presentation.

See: https://developer.mozilla.org/docs/Web/HTML/Element/input/time

If the provided value is invalid, '' is used as the value.

Was this section helpful?

Learn more about registering events

(event: <"s-time-picker">) => void

Callback when the time picker is dismissed.

(event: <"s-time-picker">) => void

Callback when the user selects a time from the picker that is different to the current value.

(event: <"s-time-picker">) => void

Callback when the time picker is revealed.

(event: <"s-time-picker">) => void

Callback when the user selects a time from the picker.

Was this section helpful?

Code

<s-button command="--show" commandFor="time-picker">
Show
</s-button>
<s-time-picker
value="9:41"
id="time-picker"
/>

Preview

TimePicker usage patterns

Show and hide TimePicker using button commands

Handle time selection events

Was this section helpful?

Command system

<>
<s-button command="--show" commandFor="time-picker">
Select Time
</s-button>
<s-time-picker
id="time-picker"
value="14:30"
onChange={(event) => console.log('Time selected:', event.target.value)}
/>
</>;