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.

(text: string) => boolean

Warning: This callback is currently broken and will not work as intended.

Custom validator function to determine the validity of an entered value.

Deprecated

This callback will be removed in version 2025-01. Please update your code to avoid using this feature.

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