TextField

fun TileSchemaBuilderScope.TextField(id: String = randomId(), events: EventSchemaBuilderScope.() -> Unit = {}, style: StyleSchemaBuilderScope.() -> Unit = {}, visibility: TileSchema.Visibility = visible(), searchableTerms: List<String>? = null, value: String = "", enabled: Boolean = true, leadingIcon: IconSchema? = null, clickableLeadingIcon: Boolean = false, trailingIcon: IconSchema? = null, clickableTrailingIcon: Boolean = true, prefixText: String? = null, suffixText: String? = null, placeholder: String? = null, label: String? = null, supportingText: String? = null, minLines: Int = 1, maxLines: Int = Int.MAX_VALUE, kind: TextFieldTileSchema.Kind = outlinedTextField(), state: TextFieldTileSchema.State = normalTextField(), keyboardOptions: TextFieldTileSchema.KeyboardOptions? = null, visualTransformation: TextFieldTileSchema.VisualTransformation? = null)

Renders a Material 3 text input field. kind picks the visual style — filled or outlined. label, prefixText, suffixText, supportingText and placeholder are shown only when non-null; enabled, minLines and maxLines are forwarded; state set to error switches the field into Material's error styling. The client keeps its own local text state seeded from value, re-syncing (and moving the caret to the end) whenever the server pushes a new value (e.g. via UpdateTiles); each keystroke updates that local state without a round trip to the server. leadingIcon / trailingIcon render as plain icons by default; setting clickableLeadingIcon / clickableTrailingIcon wraps them in a tappable IconButton that fires its own trigger. keyboardOptions configures capitalization, keyboard type, IME action, autocorrect and show-on-focus; visualTransformation masks the displayed text (e.g. for passwords). Dispatches onTextChanged (carrying the new text) on every keystroke where the text actually differs from value; the matching keyboard trigger (onKeyboardDone/onKeyboardGo/onKeyboardNext/onKeyboardPrevious/onKeyboardSearch/onKeyboardSend) when the IME action set by keyboardOptions is pressed; onLeadingIconClick only when clickableLeadingIcon is true; and onTrailingIconClick only when clickableTrailingIcon is true. The current value can be read from this tile by its id via GetData — an empty value produces no entry at all rather than an empty string.

Parameters

id

Unique identifier of the tile. Defaults to a random id.

events

Events owned by this tile, wired to its triggers (onTextChanged, keyboard actions, icon clicks).

style

Layout/appearance modifiers (size, padding, background, etc).

visibility

Whether the tile is shown, hidden but occupies space, or removed from layout. Defaults to visible.

searchableTerms

Terms used by an ancestor's search/filter to decide whether this tile matches. Defaults to none.

value

Current text shown in the field. Defaults to empty.

enabled

Whether the field is interactive. Defaults to true.

leadingIcon

Optional icon rendered before the text. Defaults to none.

clickableLeadingIcon

Whether leadingIcon is wrapped in a tappable icon button that fires onLeadingIconClick. Defaults to false.

trailingIcon

Optional icon rendered after the text. Defaults to none.

clickableTrailingIcon

Whether trailingIcon is wrapped in a tappable icon button that fires onTrailingIconClick. Defaults to true.

prefixText

Text shown fixed before the value inside the field. Defaults to none.

suffixText

Text shown fixed after the value inside the field. Defaults to none.

placeholder

Text shown when the field is empty. Defaults to none.

label

Floating label shown above/inside the field. Defaults to none.

supportingText

Helper text shown below the field. Defaults to none.

minLines

Minimum number of visible lines. Defaults to 1.

maxLines

Maximum number of visible lines. Defaults to unlimited.

kind

Visual style of the field — filledTextField or outlinedTextField. Defaults to outlined.

state

Visual state of the field — normalTextField or errorTextField. Defaults to normal.

keyboardOptions

Keyboard configuration built with keyboardOptions. Defaults to none (platform defaults).

visualTransformation

Text masking applied to the displayed value, built with keyboardVisualTransformationNone, keyboardVisualTransformationPassword or keyboardVisualTransformationCustom. Defaults to none.