Text fields and text editor

Text fields and text editor let users enter and edit text.

Page Summary

Specifications references


Please follow accessibility criteria for development


For all variants, we provide the odsTextFieldStyle view modifier to apply font, collors (background, tint) provided by the theme.

Text field

A control that displays an editable text interface.

TextField("A text field", text: $textToEdit)

### Secure text field

Use a SecureField when you want behavior similar to a TextField, but you don’t want the user’s text to be visible. Typically, you use this for entering passwords and other sensitive information.

SecureField("Secure text", text: $textToEdit)

Text editor

A text editor view allows you to display and edit multiline, scrollable text in your app’s user interface.

TextEditor(text: $textToEdit)

Text selection

Text selection is available when text field or text editor is entering in edition mode. This is not a custom component but just a way to apply right style (customize with colors, font provided by theme).