Time Field
The component captures time input from merchants with a consistent interface for time selection and proper validation. Use it to collect time information in scheduling, booking, or data entry workflows.
The component supports both 12-hour and 24-hour time formats based on locale settings, with built-in validation to ensure valid time entries. It includes features like time picker integration, keyboard shortcuts, and formatted display to streamline time entry for scheduling, appointment booking, and time-sensitive operations in retail environments.
components respects merchant locale settings for default time format preferences while allowing manual override for specific use cases that require alternative formats.
Use cases
- Scheduling: Collect appointment times or service hours in booking workflows.
- Business hours: Capture opening hours or delivery times in configuration interfaces.
- Filtering: Provide time-based filtering for reports or event logs.
- Shift management: Enable time entry for shift scheduling or time tracking.
Anchor to examplesExamples
Anchor to example-capture-time-input-with-format-validationCapture time input with format validation
Collect time information with built-in validation and format support. This example demonstrates a TimeField that handles both 12-hour and 24-hour formats based on locale, providing time picker integration and formatted display for scheduling and booking workflows.
Capture time input with format validation

Capture time input with format validation
Examples
Capture time input with format validation
Description
Collect time information with built-in validation and format support. This example demonstrates a TimeField that handles both 12-hour and 24-hour formats based on locale, providing time picker integration and formatted display for scheduling and booking workflows.
React
import React, {useState} from 'react'; import { TimeField, Screen, ScrollView, Navigator, Text, reactExtension, } from '@shopify/ui-extensions-react/point-of-sale'; const SmartGridModal = () => { const [time, setTime] = useState(''); return ( <Navigator> <Screen name="TimeField" title="TimeField Example"> <ScrollView> <TimeField label="Time" value={time} onChange={setTime} /> <Text>Selected Time: {time}</Text> </ScrollView> </Screen> </Navigator> ); }; export default reactExtension('pos.home.modal.render', () => ( <SmartGridModal /> ));TS
import { Navigator, Screen, ScrollView, Text, TimeField, extension, } from '@shopify/ui-extensions/point-of-sale'; export default extension('pos.home.modal.render', (root, api) => { const timeField = root.createComponent(TimeField, { label: 'Select Time', value: '', }); const textBox = root.createComponent(Text); const onChangeHandler = (newValue: string) => { timeField.updateProps({value: newValue}); const textContent = `Selected Time: ${newValue}`; textBox.replaceChildren(textContent); }; timeField.updateProps({onChange: onChangeHandler}); const scrollView = root.createComponent(ScrollView); scrollView.append(timeField); scrollView.append(textBox); const screen = root.createComponent(Screen, { name: 'TimeField', title: 'Time Field Example', }); screen.append(scrollView); const navigator = root.createComponent(Navigator); navigator.append(screen); root.append(navigator); });
Anchor to propertiesProperties
Configure the following properties on the component.
- Anchor to labellabelstringrequired
The content to use as the field label that describes the text information being requested.
- Anchor to actionactionInputAction
A button configuration object displayed under the text field to provide extra functionality.
- Anchor to disableddisabledboolean
Controls whether the field can be modified. When
true, the field is disabled and users cannot edit its value.- Anchor to errorerrorstring
An error message that indicates a problem to the user. The field is given specific stylistic treatment to communicate issues that must be resolved immediately.
- Anchor to helpTexthelpTextstring
The label text displayed under the field that provides guidance or instructions to assist users.
- Anchor to is24Houris24HourbooleanDefault: false
Whether the clock displays in 24-hour format instead of 12-hour format. This property only affects Android devices.
- Anchor to onBluronBlur() => void
A callback function executed when focus is removed from the field.
- Anchor to onChangeonChange(value: string) => void
A callback function executed when the user has finished editing the field, receiving the new text value as a parameter. You should update the
valueproperty in response to this callback.- Anchor to onFocusonFocus() => void
A callback function executed when the field receives focus.
- Anchor to valuevaluestring
The current text value for the field. If omitted, the field will be empty. You should update the
valueproperty in response to thecallback.
InputAction
Defines the configuration object for action buttons displayed below input fields to provide extra functionality.
- disabled
Whether the action button can be pressed.
boolean - label
The text displayed on the action button.
string - onPress
A callback function executed when the action button is pressed.
() => void
export interface InputAction {
/**
* The text displayed on the action button.
*/
label: string;
/**
* A callback function executed when the action button is pressed.
*/
onPress: () => void;
/**
* Whether the action button can be pressed.
*/
disabled?: boolean;
}Anchor to best-practicesBest practices
- Provide clear labels for time context: Use specific labels that indicate what time is being requested, like specific examples rather than generic "Time." This helps users understand the context and purpose.
- Offer helpful guidance with helpText: Use the
property to explain time constraints, business hours, or format expectations. For example, "Business hours only (9 AM - 5 PM)" or "Must be a future time." - Implement proper time validation: Use the
errorproperty to display validation messages when users enter invalid times or times outside acceptable ranges. Provide clear, actionable error messages that help users correct their input. - Add action buttons for time operations: Use the
actionproperty to provide helpful actions like "Set to Now," "Clear Time," or "Use Business Hours." This enhances usability by providing quick access to common time operations. - Handle focus events for time picker coordination: Use
andcallbacks to coordinate withcomponents or other time selection interfaces. This is useful for showing/hiding time pickers or managing related form fields.
Anchor to limitationsLimitations
provides text-based time input—for visual time selection with clock or spinner interfaces, use thecomponent which offers interactive time selection.- The
property only affects Android devices—other platforms may use their system-level time format preferences regardless of this setting. - Action buttons are limited to simple press callbacks—complex action workflows require custom implementation or additional components.