Extends Item

Apple.TextField

A iOS styled text input field.

property String text

property Color textColor: #black

The field's text and text color.

property String font: "San Francisco"

property Float size: 14

The field's text font and size.

property Color backgroundColor: #white

The background color to use in the Rounded style. If the text field is not using the Rounded style, it has no effect.

event accepted()

The text field's accepted event.

As the text is edited, the text property will update with any changes. When the user finishes editing the text, the accepted event will fire. This happens when either the field loses focus, or the return or done keys are pressed.

property String placeholder

property Color placeholderColor: #8E8E93

A placeholder string to display when there is no other text in the text field. The placeholderColor property sets the color of the placeholder text.

Apple.TextField {
    placeholder: "Search..."
}

property Apple.TextField.Style style: .Rounded

Apple.TextField.Style.Rounded

Displays a rounded-style border for the text field.

Apple.TextField.Style.None

The text field does not display a border.

property Color secondaryColor: #00000033

The secondary color controls the outline in the Rounded style, and the tint applied to the clear field button.

property Apple.TextField.ClearButtonMode clearButtonMode: .Always

Apple.TextField.ClearButtonMode.Always

Show the clear button whenever the field has text.

Apple.TextField.ClearButtonMode.Never

Never show the clear button.

Apple.TextField.ClearButtonMode.WhileEditing

Show the clear button when the field is being edited and has content.

Apple.TextField.ClearButtonMode.UnlessEditing

Show the clear button whenever the field has text and is not being edited.

property Text.Alignment alignment: .Left

Sets the horizontal alignment of the text field.

property Bool autocorrect: true

property TextEdit.KeyboardType keyboardType: .Default

property TextEdit.KeyboardAppearance keyboardAppearance: .Light

property TextEdit.AutocapitalizationType autocapitalizationType: .Sentence

These properties adjust the appearance and behavior of the keyboard shown for text entry into this text field on mobile devices.

The behavior of each property is detailed in the TextEdit reference.