Skip to content

TextFieldCore

@Composable



fun TextFieldCore(
    value: TextFieldValue, 
    onValueChange: (TextFieldValue) -> Unit, 
    font: Font, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    readOnly: Boolean = false, 
    singleLine: Boolean = true, 
    maxLength: Int = Int.MAX_VALUE, 
    maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE, 
    content: @Composable



 (state: TextFieldState) -> Unit
)

Core composable that handles all state, focus, and input logic for a text field while delegating visual rendering entirely to content.

This is the lowest-level text field building block. Build higher-level components on top of it (as TextField and BasicTextField do) to add visual decorations.

Parameters

  • value: The current TextFieldValue.

  • onValueChange: Called whenever the user modifies the text or cursor position.

  • font: The Font used for text measurement.

  • modifier: Additional modifiers applied to the invisible layout node.

  • enabled: When false, keyboard events are ignored.

  • readOnly: When true, the text can be selected and copied but not edited.

  • singleLine: When true, Enter inserts a newline; otherwise the field is single-line.

  • maxLength: Maximum permitted character count.

  • maxLines: Maximum permitted line count (only relevant when singleLine is false).

  • content: The visual content composable; receives the managed TextFieldState.