Skip to main content

TimeField
component

A component that enables users to open a dialog and select a time through a text input.

string
required

The content to use as the field label.

A button under the text field to provide extra functionality.

boolean

Whether the field can be modified.

string

Indicates an error to the user. The field is given specific stylistic treatment to communicate problems that have to be resolved immediately.

string

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

boolean
Default: false

(Android only) Whether the clock displays in 24 hour time instead of 12 hour time.

() => void

The callback when focus is removed.

(value: string) => void

The callback when the user has finished editing a field.

() => void

The callback when input is focused.

string

The current value for the field. Defaults to now. You should update this value in response to the onChange callback.

Was this section helpful?

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

Preview

  • Use a smart default time for common selections.
Was this section helpful?