Skip to main content

FormattedTextField
component

Use a formatted text field when you require additional functionality such as the text field input type or a custom validator.

Dictates when the text should be auto-capitalized.

string

Sets an error message to present to the user.

string

Populates the TextField with an text initial value.

The InputType of the TextField. This will select the appropriate keyboard.

boolean

Set whether the current value in the TextField is valid.

(value: string) => void

A callback that is executed every time the TextField value changes.

string

Sets a placeholder value for when the TextField is empty.

string

The title of the TextField.

Was this section helpful?

'text' | 'number' | 'currency' | 'giftcard' | 'email'
Was this section helpful?

Anchor to autocapitalizationtypeAutoCapitalizationType

'none' | 'sentences' | 'words' | 'characters'
Was this section helpful?

Render a FormattedTextField for an email addresses

import React, {useState} from 'react';
import {
Navigator,
Screen,
Text,
ScrollView,
FormattedTextField,
reactExtension,
} from '@shopify/ui-extensions-react/point-of-sale';

const SmartGridModal = () => {
const [textFieldValue, setTextFieldValue] =
useState('');

return (
<Navigator>
<Screen
name="FormattedTextField"
title="FormattedTextField Example"
>
<ScrollView>
<FormattedTextField
placeholder="Email address"
inputType="email"
onChangeText={setTextFieldValue}
/>
<Text>{textFieldValue}</Text>
</ScrollView>
</Screen>
</Navigator>
);
};

export default reactExtension(
'pos.home.modal.render',
() => <SmartGridModal />,
);

Preview