Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the upgrade guide to upgrade your extension.

TimeField

The TimeField component captures times through a picker. Use it to collect time information in scheduling, booking, or data entry workflows.

Keep the field controlled by passing value and updating it in onChange. Validate time constraints in your extension and use error to display feedback.

  • 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.

Configure the following properties on the TimeField component.

Anchor to label
label
string
required

The content to use as the field label that describes the text information being requested.

Anchor to action
action

A button configuration object displayed under the text field to provide extra functionality.

Anchor to disabled
disabled
boolean

Controls whether the field can be modified. When true, the field is disabled and users cannot edit its value.

Anchor to error
error
string

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 helpText
helpText
string

The label text displayed under the field that provides guidance or instructions to assist users.

Anchor to is24Hour
is24Hour
boolean
Default: false

Whether the clock displays in 24-hour format instead of 12-hour format. This property only affects Android devices.

Anchor to onBlur
onBlur
() => void

A callback function executed when focus is removed from the field.

Anchor to onChange
onChange
(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 value property in response to this callback.

Anchor to onFocus
onFocus
() => void

A callback function executed when the field receives focus.

Anchor to value
value
string

The current text value for the field. If omitted, the field will be empty. You should update the value property in response to the onChange callback.


Collect time information using a field that opens a time picker on tap. This example shows a TimeField that supports both 12-hour and 24-hour display formats for scheduling and time-sensitive operations.

Capture time input

Collect time information using a field that opens a time picker on tap. This example shows a TimeField that supports both 12-hour and 24-hour display formats for scheduling and time-sensitive operations.

Capture time input

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 />
));
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);
});

  • 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 helpText property to explain time constraints or business hours. For example, Business hours only (9 AM - 5 PM) or Must be a future time.
  • Implement proper time validation: Use the error property to display validation messages when users select invalid times or times outside acceptable ranges. Provide clear, actionable error messages that help users correct their selection.
  • Add action buttons for time operations: Use the action property 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.

  • TimeField is picker-based and doesn't accept typed input. For a standalone time picker, use the TimePicker component.
  • is24Hour sets the 12- or 24-hour format of the field's text on iOS and Android. The picker dialog uses it on Android only.
  • Action buttons are limited to simple press callbacks—complex action workflows require custom implementation or additional components.

Was this page helpful?