Expo UI provides two text field components that match the official Jetpack Compose TextField API: TextField (filled) and OutlinedTextField (outlined border). Both variants share the same props and support composable slot children for label, placeholder, icons, prefix, suffix, and supporting text.
Type
Appearance
Purpose
Filled
Solid background with a bottom indicator line.
Default text input style following Material3 design. Use for most forms and input fields.
Outlined
Transparent background with a border outline.
Alternative style that provides a distinct visual boundary. Use when filled fields blend into the background.
Both TextField and OutlinedTextField support 7 composable slots that match the Compose API: Label, Placeholder, LeadingIcon, TrailingIcon, Prefix, Suffix, and SupportingText.
TextFieldSlotsExample.tsx
import{ useState }from'react';import{Host,TextField,Text}from'@expo/ui/jetpack-compose';exportdefaultfunctionTextFieldSlotsExample(){const[value, setValue]=useState('');return(<HostmatchContents><TextFieldonValueChange={setValue}><TextField.Label><Text>Price</Text></TextField.Label><TextField.Placeholder><Text>0.00</Text></TextField.Placeholder><TextField.LeadingIcon><Text>💰</Text></TextField.LeadingIcon><TextField.Prefix><Text>$</Text></TextField.Prefix><TextField.Suffix><Text>USD</Text></TextField.Suffix><TextField.SupportingText><Text>Enter the amount</Text></TextField.SupportingText></TextField></Host>);}
Keyboard options
Use the keyboardOptions prop to configure the keyboard type, capitalization, auto-correct, and IME action.
Use the keyboardActions prop to handle IME action button presses. The triggered callback depends on the imeAction set in keyboardOptions. Each callback receives the current text value.
KeyboardActionsExample.tsx
import{ useState }from'react';import{Host,TextField,Text}from'@expo/ui/jetpack-compose';exportdefaultfunctionKeyboardActionsExample(){const[value, setValue]=useState('');const[submitted, setSubmitted]=useState('');return(<HostmatchContents><TextFieldonValueChange={setValue}singleLinekeyboardOptions={{ imeAction:'search'}}keyboardActions={{onSearch: text =>setSubmitted(text),}}><TextField.Label><Text>Search</Text></TextField.Label></TextField></Host>);}
Error state
Set isError to display the text field in an error state. Combine with SupportingText to show an error message.
ErrorStateExample.tsx
import{ useState }from'react';import{Host,OutlinedTextField,Text}from'@expo/ui/jetpack-compose';exportdefaultfunctionErrorStateExample(){const[value, setValue]=useState('');const hasError = value.length>0&&!value.includes('@');return(<HostmatchContents><OutlinedTextFieldonValueChange={setValue}isError={hasError}singleLine><OutlinedTextField.Label><Text>Email</Text></OutlinedTextField.Label><OutlinedTextField.SupportingText><Text>{hasError ?'Please enter a valid email':'Required'}</Text></OutlinedTextField.SupportingText></OutlinedTextField></Host>);}
Imperative ref
Use a ref to imperatively set text, focus, or blur the text field.