TextArea

fun UiScope.TextArea(state: TextAreaState, viewport: TextAreaViewport, enabled: Boolean = true, textStyle: TextStyle = TextStyle.TextField, wrap: TextWrap = TextWrap.Word, lineSpacing: Int = 0, modifier: Modifier = Modifier.Empty, key: ElementKey<*>? = null)(source)

Emits one multiline editor with independently placeable vertical scrolling.

Editing and deletion preserve Unicode scalars while TextAreaState.maxLength counts UTF-16 code units after newline normalization. Soft wrapping does not insert line breaks into state, and delivered IME preedit remains presentation until committed input arrives. An external Scrollbar may share TextAreaState.scrollState; the editor does not add its own scrollbar. This component does not add selection, clipboard commands, or grapheme-cluster editing. Description creation does not claim state; the retained editor claims its sole text subscription on attachment. The immutable description can be reused after detachment, but simultaneous attachment with the same state is rejected.

Receiver

active owner-thread screen scope.

Parameters

state

caller-owned text and scroll position observed by one retained editor.

viewport

exact outer size or requested count of visible text rows.

enabled

whether focus and editing are accepted.

textStyle

profile-backed color and shadow policy.

wrap

presentation-only wrapping policy.

lineSpacing

non-negative additional logical pixels between adjacent lines.

modifier

active layout, input, and typed action behavior.

key

optional stable sibling identity.

Throws

when lineSpacing is negative or the requested viewport cannot contain the editor.

when the scope or state thread is invalid or no runtime evaluation is active; retained attachment also throws when state is already attached to another retained editor.

when the active runtime does not support multiline editing.


fun UiScope.TextArea(state: TextAreaState, viewport: TextAreaViewport, font: ResourceId, enabled: Boolean = true, textStyle: TextStyle = TextStyle.TextField, wrap: TextWrap = TextWrap.Word, lineSpacing: Int = 0, modifier: Modifier = Modifier.Empty, key: ElementKey<*>? = null)(source)

Emits one multiline editor using an explicitly selected resource-pack font.

The selected font supplies layout, drawing, cursor, and scroll metrics from the runtime's pinned resource state. Text, IME, scrolling, scalar editing, and ownership follow the default-font TextArea contract. Description creation does not claim state; the retained editor claims its sole text subscription on attachment. The immutable description can be reused after detachment, but simultaneous attachment with the same state is rejected.

Receiver

active owner-thread screen scope.

Parameters

state

caller-owned text and scroll position observed by one retained editor.

viewport

exact outer size or requested count of visible text rows.

font

structural identifier of the font definition.

enabled

whether focus and editing are accepted.

textStyle

profile-backed color and shadow policy.

wrap

presentation-only wrapping policy.

lineSpacing

non-negative additional logical pixels between adjacent lines.

modifier

active layout, input, and typed action behavior.

key

optional stable sibling identity.

Throws

when lineSpacing is negative or the requested viewport cannot contain the editor.

when the scope or state thread is invalid or no runtime evaluation is active; retained attachment also throws when state is already attached to another retained editor.

when the active runtime does not support multiline editing with explicit font selection.