TextField

fun UiScope.TextField(state: TextFieldState, enabled: Boolean = true, textStyle: TextStyle = TextStyle.TextField, modifier: Modifier = Modifier.Empty, key: ElementKey<*>? = null)(source)

Emits one 200 by 20 single-line text field.

Editing preserves Unicode scalars while TextFieldState.maxLength counts UTF-16 code units. Delivered preedit text remains inline presentation state until committed input arrives. The component does not install a platform candidate window or add selection and clipboard commands.

Receiver

active owner-thread screen scope.

Parameters

state

owner-thread text value observed by the retained field.

enabled

whether focus and editing are accepted.

textStyle

profile-backed glyph style.

modifier

active behavior applied to the field.

key

optional stable sibling identity.

Throws

when the scope or state thread is invalid or no runtime evaluation is active.


fun UiScope.TextField(state: TextFieldState, size: IntSize, enabled: Boolean = true, textStyle: TextStyle = TextStyle.TextField, modifier: Modifier = Modifier.Empty, key: ElementKey<*>? = null)(source)

Emits one explicitly sized single-line text field.

Receiver

active owner-thread screen scope.

Parameters

state

owner-thread text value observed by the retained field.

size

exact logical field extent.

enabled

whether focus and editing are accepted.

textStyle

profile-backed glyph style.

modifier

active behavior applied to the field.

key

optional stable sibling identity.

Throws

when size cannot contain the field or later constraints exclude it.

when the scope or state thread is invalid or no runtime evaluation is active.


fun UiScope.TextField(state: TextFieldState, font: ResourceId, enabled: Boolean = true, textStyle: TextStyle = TextStyle.TextField, modifier: Modifier = Modifier.Empty, key: ElementKey<*>? = null)(source)

Emits one 200 by 20 single-line text field using an explicitly selected resource-pack font.

Receiver

active owner-thread screen scope.

Parameters

state

caller-owned text value observed by the retained field.

font

structural identifier of the font definition.

enabled

whether focus and editing are accepted.

textStyle

profile-backed color and shadow policy.

modifier

active behavior applied to the field.

key

optional stable sibling identity.

Throws

when the scope or state thread is invalid or no runtime evaluation is active.


fun UiScope.TextField(state: TextFieldState, size: IntSize, font: ResourceId, enabled: Boolean = true, textStyle: TextStyle = TextStyle.TextField, modifier: Modifier = Modifier.Empty, key: ElementKey<*>? = null)(source)

Emits one explicitly sized single-line text field using a selected resource-pack font.

The selected font supplies both drawing and cursor metrics from the runtime's pinned resource state. Movement and deletion operate on Unicode scalars, not grapheme clusters, and TextFieldState.maxLength remains a UTF-16 bound.

Receiver

active owner-thread screen scope.

Parameters

state

caller-owned text value observed by the retained field.

size

exact logical field extent.

font

structural identifier of the font definition.

enabled

whether focus and editing are accepted.

textStyle

profile-backed color and shadow policy.

modifier

active behavior applied to the field.

key

optional stable sibling identity.

Throws

when size cannot contain the field or later constraints exclude it.

when the scope or state thread is invalid or no runtime evaluation is active.