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
| Parameter | Type | Default | Description |
|---|---|---|---|
value | String | — | The current text value of the input field. |
onValueChange | (String) -> Unit | — | Callback invoked when the text changes. |
modifier | Modifier | Modifier | Modifier applied to the input field. |
placeholder | String | "" | Placeholder text shown when the field is empty and not focused. |
enabled | Boolean | true | When false, interaction is disabled and muted colors are applied. |
readOnly | Boolean | false | When true, the field is not editable but remains focusable and selectable. |
isError | Boolean | false | When true, the border color switches to the error/destructive color. |
visualTransformation | VisualTransformation | VisualTransformation.None | Transforms how text is visually displayed, e.g. PasswordVisualTransformation. |
interactionSource | MutableInteractionSource? | null | Custom interaction source. A new one is created internally when null. |
leadingIcon | @Composable (() -> Unit)? | null | Optional slot rendered at the start of the field, inside the content row. |
trailingIcon | @Composable (() -> Unit)? | null | Optional slot rendered at the end of the field, inside the content row. |
supportingText | @Composable (() -> Unit)? | null | Optional slot rendered below the field with small muted text style. |
singleLine | Boolean | false | When true, the field collapses to a single line and disables newlines. |
maxLines | Int | Int.MAX_VALUE (1 if singleLine) | Maximum number of visible lines before the field scrolls. |
minLines | Int | 1 | Minimum number of lines the field will occupy. |
keyboardOptions | KeyboardOptions | KeyboardOptions.Default | Keyboard type, capitalization, auto-correct, and IME action. |
keyboardActions | KeyboardActions | KeyboardActions.Default | Callbacks for IME actions such as Done, Next, or Go. |
variant | InputVariant | InputVariant.Outlined | Visual style of the input field — see InputVariant. |
colors | InputStyle | InputDefaults.colors() | Color overrides for the input. Use InputDefaults.colors { copy(...) } to customize. |
InputVariant
| Value | Description |
|---|---|
Outlined | Rounded border drawn on all sides, with background fill. |
Underlined | Only a bottom border line is drawn; no surrounding border. |
InputStyle
Returned by InputDefaults.colors(). Pass to the colors parameter to override tokens.
| Field | Type | Description |
|---|---|---|
background | Color | Background fill when the field is enabled. Default is Color.Unspecified (transparent). |
disableBackground | Color | Background fill when enabled = false. |
text | Color | Text color when enabled. |
disableText | Color | Text color when enabled = false. |
placeholder | Color | Placeholder text color. |
border | InputBorderStyle | Border colors for each state — see InputBorderStyle. |
supportingText | Color | Color of the supportingText slot content. |
InputBorderStyle
Nested inside InputStyle.border.
| Field | Type | Description |
|---|---|---|
default | Color | Border color in the default (unfocused) state. |
focus | Color | Border color when the field has focus. |
error | Color | Border color when isError = true. |
InputDefaults
| Member | Description |
|---|---|
colors(): InputStyle | Returns the default InputStyle resolved from the current MaterialTheme. |
colors(overrides: InputStyle.() -> InputStyle): InputStyle | Returns the default style with selective overrides. Use copy(...) inside the lambda. |