Time Fieldcomponent
A component that enables users to open a dialog and select a time through a text input.
Anchor to timefieldTimeField
- Anchor to labellabelstringrequired
The content to use as the field label.
- Anchor to actionaction
A button under the text field to provide extra functionality.
- Anchor to disableddisabledboolean
Whether the field can be modified.
- Anchor to errorerrorstring
Indicates an error to the user. The field is given specific stylistic treatment to communicate problems that have to be resolved immediately.
- Anchor to helpTexthelpTextstring
The label under the text field which provides guidance or instructions that assist users.
- Anchor to is24Houris24HourbooleanDefault: false
(Android only) Whether the clock displays in 24 hour time instead of 12 hour time.
- Anchor to onBluronBlur() => void
The callback when focus is removed.
- Anchor to onChangeonChange(value: string) => void
The callback when the user has finished editing a field.
- Anchor to onFocusonFocus() => void
The callback when input is focused.
- Anchor to valuevaluestring
The current value for the field. Defaults to now. You should update this value in response to the
callback.
TimeFieldProps
- action
A button under the text field to provide extra functionality.
InputAction
- disabled
Whether the field can be modified.
boolean
- error
Indicates an error to the user. The field is given specific stylistic treatment to communicate problems that have to be resolved immediately.
string
- helpText
The label under the text field which provides guidance or instructions that assist users.
string
- is24Hour
(Android only) Whether the clock displays in 24 hour time instead of 12 hour time.
boolean
- label
The content to use as the field label.
string
- onBlur
The callback when focus is removed.
() => void
- onChange
The callback when the user has finished editing a field.
(value: string) => void
- onFocus
The callback when input is focused.
() => void
- value
The current value for the field. Defaults to now. You should update this value in response to the `onChange` callback.
string
export interface TimeFieldProps
extends Pick<
InputProps,
| 'value'
| 'error'
| 'label'
| 'disabled'
| 'onFocus'
| 'onBlur'
| 'onChange'
| 'action'
| 'helpText'
> {
/**
* (Android only) Whether the clock displays in 24 hour time instead of 12 hour time.
* @defaultValue false
*/
is24Hour?: boolean;
}
InputAction
- disabled
Whether the button can be pressed.
boolean
- label
The text displayed in the button.
string
- onPress
A callback to be performed.
() => void
export interface InputAction {
/**
* The text displayed in the button.
*/
label: string;
/**
* A callback to be performed.
*/
onPress: () => void;
/**
* Whether the button can be pressed.
*/
disabled?: boolean;
}
Time input
examples
Time input
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); });
Preview

Anchor to guidelinesGuidelines
- Use a smart default time for common selections.