LavaUI docs

struct TextField

Swift

struct TextField

Single-line editable text.

Step 1 of the plan's Phase 7 ladder: Latin, no IME, no multi-line. The editing logic itself is TextEditingState in LavaText (pure, tested headlessly); this type is only the view/node plumbing around it.

The buffer lives on the node, not in @State, because a PrimitiveView has no body and so never goes through CompositeNode's state transplant. The node persists across rebuilds, which is the same guarantee.

Focus chrome comes from Theme.focusRingStyle by default (a full rounded outline). Pass focusRing: / focusRingWidth: / focusRingColor: to override per field — e.g. .underline for the historical top+bottom bars.

Sources/LavaUI/TextField.swift:16

Constructors

init(text: Binding<String>, placeholder: String = "", font: UIFont? = nil, multiline: Bool = false, maxLines: Int = 8, wraps: Bool = false, autoFocus: Bool = false, focusRing: FocusRingStyle? = nil, focusRingWidth: Float? = nil, focusRingColor: Color? = nil, onSubmit: (() -> Void)? = nil)

Not documented.

Sources/LavaUI/TextField.swift:46

Properties

var autoFocus: Bool

Take the caret as soon as this field appears.

For the window whose entire purpose is one field — a launcher, a search overlay, a rename prompt. Without it the user has to click the box before typing, which is asking them to aim at something before saying what they want.

Only on mount, and only when nothing else in the window is focused: a field that re-took focus on every reconcile would steal the caret back from wherever the user had since put it.

Sources/LavaUI/TextField.swift:40

var dumpDetail: String { get }

Not documented.

Sources/LavaUI/TextField.swift:74

var focusRing: FocusRingStyle?

Overrides Theme.focusRingStyle when set.

Sources/LavaUI/TextField.swift:42

var focusRingColor: Color?

Not documented.

Sources/LavaUI/TextField.swift:44

var focusRingWidth: Float?

Not documented.

Sources/LavaUI/TextField.swift:43

var font: UIFont?

Not documented.

Sources/LavaUI/TextField.swift:19

var isMultiline: Bool

When true, Enter inserts a newline instead of submitting, and the box grows to fit its lines. Hard line breaks only for now — soft wrap is a separate step, because a wrapped visual line is no longer a logical one and every index mapping has to account for that.

Sources/LavaUI/TextField.swift:25

var maxLines: Int

Height cap in rows when multi-line; the box grows up to this.

Sources/LavaUI/TextField.swift:27

var onSubmit: (() -> Void)?

Not documented.

Sources/LavaUI/TextField.swift:20

var placeholder: String

Not documented.

Sources/LavaUI/TextField.swift:18

var resolvedFont: UIFont? { get }

Not documented.

Sources/LavaUI/TextField.swift:72

@Binding var text: String { get nonmutating set }

Not documented.

Sources/LavaUI/TextField.swift:17

var wraps: Bool

Wrap long lines to the field width instead of letting them overflow.

Sources/LavaUI/TextField.swift:29

Methods

func mountPrimitive() -> any AnyViewNode

Not documented.

Sources/LavaUI/TextField.swift:76

func reconcilePrimitive(_ node: any AnyViewNode) -> any AnyViewNode

Not documented.

Sources/LavaUI/TextField.swift:87