Skip to content

TextField

Edits a single line of text.

<TextField ... />

Overview

This component is backed by the platform control or container. Prefer its XML tag in an .etlua template; keep view-tree construction out of controllers.

Topics

Properties

Name Type Required Description
accessibilityLabel value optional Component-specific setting passed to the native control.
bezeled boolean optional Shows the native bezel when true.
color string optional Text color: a semantic color name or a #light|#dark hex pair.
bordered boolean optional Shows the native border when true.
defaultFocus boolean optional Receives keyboard focus when its sheet is presented (SwiftUI .defaultFocus).
disabled boolean optional Component-specific setting passed to the native control.
drawsBackground boolean optional Draws the control’s background when true.
editable boolean optional Allows text editing when true.
focusRing boolean optional Shows the native keyboard focus ring when true.
onChange function optional Callback invoked when the value changes.
onCommand function optional Callback invoked for the corresponding keyboard command.
onFocus function optional Callback invoked when editing begins and the keyboard is shown.
placeholder string optional Component-specific setting passed to the native control.
style string optional plain removes the field bezel and background; roundedBorder keeps the system field bezel.
secure boolean optional Masks entered text when true.
selectable boolean optional Allows text or rows to be selected when true.
size number optional Component-specific setting passed to the native control.
value table optional Current selected, edited, or measured value.
weight value optional Component-specific setting passed to the native control.

Example

<TextField />

Platform notes

  • AppKit uses the AppKit implementation. UIKit uses the UIKit implementation.

Source: lua/embedded/AppKit.lua:1133 (AppKit.TextField)