This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
SecureField
A SwiftUI SecureField component for password input.
Expo UI SecureField matches the official SwiftUI SecureField API and provides a text field that masks user input for passwords and other sensitive text.


Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Basic secure field
Submit handling
Use the submitLabel and onSubmit modifiers to handle form submission from the keyboard.
Imperative ref
Use a ref to imperatively set text, focus, or blur the secure field.
API
import { SecureField } from '@expo/ui/swift-ui';
Component
Type: React.Element<SecureFieldProps>
Renders a SwiftUI SecureField for password input.
boolean • Default: falseIf true, the secure field will be focused automatically when mounted.
React.ReactNodeSlot children - supports <SecureField.Placeholder> with a <Text> child
numberMaximum number of characters allowed. Truncates natively as the user types.
(focused: boolean) => voidA callback triggered when the field gains or loses focus.
(text: string) => voidA callback triggered when the text value changes.
If the callback is marked with the 'worklet' directive, it runs synchronously
on the UI thread; otherwise it is delivered asynchronously as a regular JS event.
Ref<SecureFieldRef>ObservableState<string>An observable state that holds the current text.
Create one with useNativeState('') or useNativeState('initial value').
If omitted, the field manages its own internal state.