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

androidx.compose.ui.text.input

Interfaces

EditCommand

EditCommand is a command representation for the platform IME API function calls.

InputEventCallback

An interface of listening IME events.

OffsetMapping

Provides bidirectional offset mapping between original and transformed text.

PlatformTextInputService

Platform specific text input service.

VisualTransformation

Interface used for changing visual output of the input field.

Classes

BackspaceCommand

Represents a backspace operation at the cursor position.

CommitTextCommand

Commit final text to the text box and set the new cursor position.

DeleteAllCommand

Deletes all the text in the buffer.

DeleteSurroundingTextCommand

Delete lengthBeforeCursor characters of text before the current cursor position, and delete lengthAfterCursor characters of text after the current cursor position, excluding the selection.

DeleteSurroundingTextInCodePointsCommand

A variant of DeleteSurroundingTextCommand.

EditingBuffer

The editing buffer

EditorValue

Stores an input state for IME

FinishComposingTextCommand

Finishes the composing text that is currently active.

ImeOptions

The IME configuration options for TextInputService.

MoveCursorCommand

Moves the cursor with amount characters.

PasswordVisualTransformation

The Visual Filter can be used for password Input Field.

SetComposingRegionCommand

Mark a certain region of text as composing text.

SetComposingTextCommand

Replace the currently composing text with the given text, and set the new cursor position.

SetSelectionCommand

Sets the selection on the text.

TextFieldValue

A class holding information about the editing state.

TextInputService

Provide a communication with platform text input service.

TransformedText

The transformed text with offset offset mapping

Type-aliases

InputSessionToken

The input session token.

Enums

ImeAction

Enums used for indicating IME action.

KeyboardCapitalization

Options to request software keyboard to capitalize the text.

KeyboardType

Enums used for indicating keyboard types

Top-level constants summary

const InputSessionToken

A special session token which represents the session couldn't be established.

const InputSessionToken

A special session token which represents there is no active input session.

Extension functions summary

For TextFieldValue
String

Returns the currently selected text.

String

Returns the text after the selection.

String

Returns the text before the selection.

Top-level constants

INVALID_SESSION

const val INVALID_SESSION: InputSessionToken

A special session token which represents the session couldn't be established.

Value: -1

NO_SESSION

const val NO_SESSION: InputSessionToken

A special session token which represents there is no active input session.

Value: 0

Extension functions

getSelectedText

fun TextFieldValue.getSelectedText(): String

Returns the currently selected text.

getTextAfterSelection

fun TextFieldValue.getTextAfterSelection(maxChars: Int): String

Returns the text after the selection.

getTextBeforeSelection

fun TextFieldValue.getTextBeforeSelection(maxChars: Int): String

Returns the text before the selection.