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.

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

Dictates when the text should be auto-capitalized.

(text: string) => boolean

Applies a custom validator that can dictate whether or not an entered value is valid.

string

The title of the TextField.

string

Populates the TextField with an text initial value.

string

Sets a placeholder value for when the TextField is empty.

boolean

Set whether the current value in the TextField is valid.

string

Sets an error message to present to the user.

(value: string) => void

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

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 that validates 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="TextArea"
title="Text Area 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