Skip to main content
TextField is the standard single-line input. SecureField is the same shape but obscures its contents for passwords and other sensitive data. TextEditor is a multi-line editing area for longer-form text. All three follow the same controlled-input pattern: pass the current text value and a setText callback. Style them with shared modifiers like .textFieldStyle(), .keyboardType(), and .autocorrectionDisabled().

TextField

A single-line text input field with an optional placeholder.
string
Placeholder text displayed when the field is empty.
string
required
The current text value of the field.
(text: string) => void
required
Callback invoked when the user types. Use this to update your state.
Basic text field
With style modifiers
Form with multiple fields

SecureField

A text input that obscures its contents, used for passwords and sensitive data.
string
Placeholder text displayed when the field is empty.
string
required
The current text value of the field (displayed as masked characters).
(text: string) => void
required
Callback invoked when the user types. Use this to update your state.
Basic password field
Login form

TextEditor

A multi-line text editing area for longer form text input.
string
required
The current text content displayed in the editor.
(text: string) => void
required
Callback invoked when the user edits the text. Use this to update your state.
Basic text editor
With frame and border
In a form layout

See also

  • Text — read-only text display
  • Button — submit form actions
  • Toggle — boolean switch alongside fields in a form
  • VStack — vertical layout for stacking form fields