Google is committed to advancing racial equity for Black communities. See how.

TextFieldValue

@Immutable data class TextFieldValue
kotlin.Any
   ↳ androidx.ui.foundation.TextFieldValue

A class holding information about the editing state.

The input service updates text selection or cursor as well as text. You can observe and control the selection, cursor and text altogether.

Summary

Public constructors
<init>(text: String = "", selection: TextRange = TextRange.Zero)

A class holding information about the editing state.

Properties
TextRange

the selection range.

String

the text will be rendered

Companion properties
Saver<TextFieldValue, Any>

The default Saver implementation for TextFieldValue.

Public constructors

<init>

TextFieldValue(
    text: String = "",
    selection: TextRange = TextRange.Zero)

A class holding information about the editing state.

The input service updates text selection or cursor as well as text. You can observe and control the selection, cursor and text altogether.

Parameters
text: String = "" the text will be rendered
selection: TextRange = TextRange.Zero the selection range. If the selection is collapsed, it represents cursor location. Do not specify outside of the text buffer.

Properties

selection

@Stable val selection: TextRange

the selection range. If the selection is collapsed, it represents cursor location. Do not specify outside of the text buffer.

text

@Stable val text: String

the text will be rendered

Companion properties

Saver

val Saver: Saver<TextFieldValue, Any>

Deprecated.

The default Saver implementation for TextFieldValue.