Skip to main content

TimePicker

The TimePicker component allows merchants to select times using an interactive picker interface. Use it when merchants benefit from visual time selection rather than typing exact times.

For direct text entry when merchants know the exact time, use TimeField.

Configure the following properties on the TimePicker component.

string

A unique identifier for the element used for targeting with CSS, JavaScript, or accessibility features.

string
Default: ''

The current selected value in 24-hour format. An empty string means no time is selected. The value must be in HH:mm:ss format with leading zeros (for example, "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.

The TimePicker component provides event callbacks for handling user interactions. Learn more about handling events.

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

Called when the element loses focus.

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

Called after editing completes, typically on blur.

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

Called when the element receives focus.

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

Called when the user makes any changes in the field.

Select times with a time picker

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

Preview

  • Choose for visual time selection: Use TimePicker when users benefit from a visual picker interface. Use TimeField when users know the exact time.
  • Use correct format: Always use HH:mm:ss format with leading zeros. The internal format is always 24-hour regardless of UI presentation.
  • Validate before setting values: Invalid values reset to empty string. Implement validation to show appropriate error messages.
Was this section helpful?

Learn how to control picker visibility and handle time selection events.

Control TimePicker visibility programmatically using the command system with show and hide methods. This example demonstrates using button commands to display or dismiss the time picker, enabling custom trigger patterns for time selection workflows.

Subscribe to time selection events to respond when merchants pick a time. This example shows how to handle onChange events to capture selected times, enabling validation, scheduling logic, or dynamic updates based on the chosen time.

Was this section helpful?

Control picker visibility

<>
<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.currentTarget.value)}
/>
</>;
Was this page helpful?