Skip to content

TextFieldState

@Stable



class TextFieldState

Internal mutable state for a text field, tracking focus, scroll position, cursor blink, and layout dimensions.

Obtain an instance via rememberTextFieldState and pass it to TextFieldCore.

Constructors

TextFieldState

constructor()

Properties

displayPos

Horizontal scroll offset for single-line fields (index of the first visible character).

isDraggingScrollbar

Whether the user is dragging the multi-line scroll bar.

isFocused

Whether the field currently holds input focus.

scrollY

Vertical scroll offset for multi-line fields, in pixels.

showCursor

Whether the blinking cursor is currently visible.

Functions

onFocusChange

fun onFocusChange(focused: Boolean)

Updates focus state and resets the cursor blink timer on focus gain.