Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, such as auto-correction, auto-capitalization, placeholder text, and different keyboard types, such as a numeric keypad. The most basic use case is to plop down a TextInput and subscribe to the onChangeText events to read the user input. There are also other events, such as onSubmitEditing and onFocus that can be subscribed to. A minimal example:
Two methods exposed via the native element are .focus() and .blur() that will focus or blur the TextInput programmatically. Note that some props are only available with multiline={true/false}. Additionally, border styles that apply to only one side of the element (e.g., borderBottomColor, borderLeftWidth, etc.) will not be applied if multiline=true. To achieve the same effect, you can wrap your TextInput in a View:
TextInput has by default a border at the bottom of its view. This border has its padding set by the background image provided by the system, and it cannot be changed. Solutions to avoid this are to either not set height explicitly, in which case the system will take care of displaying the border in the correct position, or to not display the border by setting underlineColorKepler to transparent.

Reference

Props

View props

Inherits View Props.

aria-labelledby

Identifies the element that labels the element it is applied to. The value of aria-labelledby should match the nativeID of the related element:

autoCapitalize

Tells TextInput to automatically capitalize certain characters.
  • characters: all characters.
  • words: first letter of each word.
  • sentences: first letter of each sentence (default).
  • none: don’t auto capitalize anything.

autoFocus

If true, focuses the input on componentDidMount or useEffect. The default value is false.

blurOnSubmit

If true, the text field will blur when submitted. The default value is true for single-line fields and false for multiline fields. Note that for multiline fields, setting blurOnSubmit to true means that pressing return will blur the field and trigger the onSubmitEditing event instead of inserting a newline into the field.

auxOptions

An optional set of key:value pairs, that provide additional context to a TV-based keyboard. For example: To include a title in your keyboard: auxOptions="title:Search for Videos" To set wifi special keyboard options: auxOptions="wifi:true" To show validation error message using wifi keyboard: auxOptions="title:Enter Wireless Password,wifi:true"

defaultValue

Provides an initial value that will change when the user starts typing. Useful for use-cases where you do not want to deal with listening to events and updating the value prop to keep the controlled state in sync.

editable

If false, text is not editable. The default value is true.

enablesReturnKeyAutomatically

If true, the keyboard disables the return key when there is no text and automatically enables it when there is text. The default value is false.

enterKeyHint

Determines what text should be shown to the return key. Has precedence over the returnKeyType prop. The following values work across platforms:
  • enter
  • done
  • next
  • search
  • send

inputMode

Works like the inputmode attribute in HTML, it determines which keyboard to open, e.g. numeric and has precedence over keyboardType. Support the following values:
  • none
  • text
  • decimal
  • numeric
  • tel
  • search
  • email
  • url

keyboardType

Determines which keyboard to open, e.g.numeric. See screenshots of all the types here.
  • default
  • number-pad
  • decimal-pad
  • numeric
  • email-address
  • phone-pad
  • url
  • pin

maxLength

Limits the maximum number of characters that can be entered. Use this instead of implementing the logic in JS to avoid flicker.

numberOfLines

Sets the number of lines for a TextInput. Use it with multiline set to true to be able to fill the lines.

onBlur

Callback that is called when the text input is blurred. Note: If you are attempting to access the text value from nativeEvent keep in mind that the resulting value you get can be undefined which can cause unintended errors. If you are trying to find the last value of TextInput, you can use the onEndEditing event, which is fired upon completion of editing.

onChange

Callback that is called when the text input’s text changes.

onContentSizeChange

Callback that is called when the text input’s content size changes. Only called for multiline text inputs.

onEndEditing

Callback that is called when text input ends.

onFocus

Callback that is called when the text input is focused.

onKeyPress

Callback that is called when a key is pressed. This will be called with object where keyValue is 'Enter' or 'Backspace' for respective keys and the typed-in character otherwise including ' ' for space. Fires before onChange callbacks.

onLayout

Invoked on mount and on layout changes.

onSubmitEditing

Callback that is called when the text input’s submit button is pressed. Note the following differences in the React Native for Vega implementation:
  • The onSubmitEditing event also contains submitAction. The value of submitAction is the action string(similar to returnKeyType) or any numeric value which is set by the user in auxOptions prop.
  • onSubmitEditing only works when returnKeyType is also set. To work around this, set returnKeyType.
  • onSubmitEditing will sometimes not fire on the first mount if autofocus is true. To work around this, set autofocus to false.

placeholder

The string that will be rendered before text input has been entered.

placeholderTextColor

The text color of the placeholder string.

readOnly

If true, text is not editable. The default value is false.

returnKeyType

Determines how the return key should look. The following values work across platforms:
  • done
  • go
  • next
  • search
  • send

rows

Sets the number of lines for a TextInput. Use it with multiline set to true to be able to fill the lines.

secureTextEntry

If true, the text input obscures the text entered so that sensitive text like passwords stay secure. The default value is false. Does not work with multiline={true}.

selectionColor

The highlight and cursor color of the text input.

selection

The start and end of the text input’s selection. Set start and end to the same value to position the cursor.

selectTextOnFocus

If true, all text will automatically be selected on focus.

showSoftInputOnFocus

When false, it will prevent the soft keyboard from showing when the field is focused. The default value is true. Note: On Vega, when autoFocus is set to true, showSoftInputOnFocus will not prevent soft keyboard from opening on first mount, regardless of its value. As a workaround, remove autoFocus or set autoFocus to false.

style

Note that not all Text styles are supported, an incomplete list of what is not supported includes:
  • borderLeftWidth
  • borderTopWidth
  • borderRightWidth
  • borderBottomWidth
  • borderTopLeftRadius
  • borderTopRightRadius
  • borderBottomRightRadius
  • borderBottomLeftRadius
see Issue#7070 for more detail. Styles

textAlign

Align the input text to the left, center, or right sides of the input field. Possible values for textAlign are:
  • left
  • center
  • right

underlineColorKepler

The color of the TextInput underline.

value

The value to show for the text input. TextInput is a controlled component, which means the native value will be forced to match this value prop if provided. For most uses, this works great, but in some cases this may cause flickering - one common cause is preventing edits by keeping value the same. In addition to setting the same value, either set editable={false}, or set/update maxLength to prevent unwanted edits without flicker.

Methods

isFocused()

Returns true if the input is currently focused; false otherwise.

clear()

Removes all text from the TextInput.
Last modified on December 10, 2025