Input

Displays a form input field or a component that looks like an input field.

Basic Usage

With Leading Icon

With Visual Transformation

Underline

Disabled

Read-only

With Error

Custom Colors

Use InputDefaults.colors { copy(...) } to override individual color tokens without replacing the entire style.

API Reference

Input

ParameterTypeDefaultDescription
valueStringThe current text value of the input field.
onValueChange(String) -> UnitCallback invoked when the text changes.
modifierModifierModifierModifier applied to the input field.
placeholderString""Placeholder text shown when the field is empty and not focused.
enabledBooleantrueWhen false, interaction is disabled and muted colors are applied.
readOnlyBooleanfalseWhen true, the field is not editable but remains focusable and selectable.
isErrorBooleanfalseWhen true, the border color switches to the error/destructive color.
visualTransformationVisualTransformationVisualTransformation.NoneTransforms how text is visually displayed, e.g. PasswordVisualTransformation.
interactionSourceMutableInteractionSource?nullCustom interaction source. A new one is created internally when null.
leadingIcon@Composable (() -> Unit)?nullOptional slot rendered at the start of the field, inside the content row.
trailingIcon@Composable (() -> Unit)?nullOptional slot rendered at the end of the field, inside the content row.
supportingText@Composable (() -> Unit)?nullOptional slot rendered below the field with small muted text style.
singleLineBooleanfalseWhen true, the field collapses to a single line and disables newlines.
maxLinesIntInt.MAX_VALUE (1 if singleLine)Maximum number of visible lines before the field scrolls.
minLinesInt1Minimum number of lines the field will occupy.
keyboardOptionsKeyboardOptionsKeyboardOptions.DefaultKeyboard type, capitalization, auto-correct, and IME action.
keyboardActionsKeyboardActionsKeyboardActions.DefaultCallbacks for IME actions such as Done, Next, or Go.
variantInputVariantInputVariant.OutlinedVisual style of the input field — see InputVariant.
colorsInputStyleInputDefaults.colors()Color overrides for the input. Use InputDefaults.colors { copy(...) } to customize.

InputVariant

ValueDescription
OutlinedRounded border drawn on all sides, with background fill.
UnderlinedOnly a bottom border line is drawn; no surrounding border.

InputStyle

Returned by InputDefaults.colors(). Pass to the colors parameter to override tokens.

FieldTypeDescription
backgroundColorBackground fill when the field is enabled. Default is Color.Unspecified (transparent).
disableBackgroundColorBackground fill when enabled = false.
textColorText color when enabled.
disableTextColorText color when enabled = false.
placeholderColorPlaceholder text color.
borderInputBorderStyleBorder colors for each state — see InputBorderStyle.
supportingTextColorColor of the supportingText slot content.

InputBorderStyle

Nested inside InputStyle.border.

FieldTypeDescription
defaultColorBorder color in the default (unfocused) state.
focusColorBorder color when the field has focus.
errorColorBorder color when isError = true.

InputDefaults

MemberDescription
colors(): InputStyleReturns the default InputStyle resolved from the current MaterialTheme.
colors(overrides: InputStyle.() -> InputStyle): InputStyleReturns the default style with selective overrides. Use copy(...) inside the lambda.
Edit this page on GitHub