Text Field

TextField

A customizable text input component that supports various input types and decorations.


Installation

./gradlew lumo --add TextField

Usage

TextField Example

var text1 by remember { mutableStateOf("") }
var text2 by remember { mutableStateOf("") }
var text3 by remember { mutableStateOf("") }
 
TextField(
    value = text1,
    onValueChange = { text1 = it },
    label = { Text("Label") },
    placeholder = { Text("Placeholder") }
)
 
OutlinedTextField(
    value = text2,
    onValueChange = { text2 = it },
    label = { Text("Label") },
    placeholder = { Text("Placeholder") }
)
 
UnderlinedTextField(
    value = text3,
    onValueChange = { text3 = it },
    label = { Text("Label") },
    placeholder = { Text("Placeholder") }
)

API Documentation

TextField Types

ComponentDescription
TextFieldBasic filled style text input
OutlinedTextFieldText input with outlined style
UnderlinedTextFieldText input with underline style

Parameters

ParameterTypeDescription
valueStringCurrent text value
onValueChange(String) -> UnitCallback when text changes
modifierModifierModifier for the text field
enabledBooleanWhether field is enabled
readOnlyBooleanWhether field is read-only
textStyleTextStyleStyle for input text
label@Composable (() -> Unit)?Label content above the field
placeholder@Composable (() -> Unit)?Placeholder when field is empty
leadingIcon@Composable (() -> Unit)?Icon at the start of the field
trailingIcon@Composable (() -> Unit)?Icon at the end of the field
prefix@Composable (() -> Unit)?Fixed content before the input
suffix@Composable (() -> Unit)?Fixed content after the input
supportingText@Composable (() -> Unit)?Helper text below the field
isErrorBooleanWhether to show error state
visualTransformationVisualTransformationTransform for the visual output
keyboardOptionsKeyboardOptionsKeyboard configuration
keyboardActionsKeyboardActionsKeyboard action handlers
singleLineBooleanWhether to limit to single line
maxLinesIntMaximum number of lines
shapeShapeShape of the text field
colorsTextFieldColorsColors for different states