StylishFilledTextField

fun StylishFilledTextField(value: String, onValueChange: (String) -> Unit, label: String = "", placeholder: String = "", modifier: Modifier = Modifier, minLines: Int = 1, maxLines: Int = if (minLines == 1) 1 else Int.MAX_VALUE, isError: Boolean = false, errorMessage: String? = null, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, textStyle: TextStyle = MaterialTheme.typography.bodyLarge, shape: Shape = TextFieldDefaults.shape, colors: TextFieldColors? = null, enabled: Boolean = true, readOnly: Boolean = false, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions.Default, visualTransformation: VisualTransformation = VisualTransformation.None, singleLine: Boolean = false, interactionSource: MutableInteractionSource? = null, prefix: @Composable () -> Unit? = null, suffix: @Composable () -> Unit? = null, supportingContent: @Composable () -> Unit? = null)

A filled text field designed for form input, with built-in label, placeholder, and error-message support. Wraps Material's TextField (the filled variant) with the same layout contract as StylishFormTextField, which is the outlined counterpart.

When minLines is 1 and maxLines is 1 (the default), the field operates in single-line mode. Setting minLines greater than 1 switches to a multiline field whose maxLines defaults to Int.MAX_VALUE. When singleLine is true, both minLines and maxLines are forced to 1 (matching Material's single-line contract).

Error display follows a priority chain: if supportingContent is provided it is used as-is; otherwise, when errorMessage is non-null, it is rendered as supporting text in MaterialTheme.colorScheme.error. The isError flag independently controls the field's error indicator color.

Parameters

value

Current text value (controlled state).

onValueChange

Called with the updated text on every edit.

label

Label displayed above the field. Defaults to "", which renders no label region at all.

placeholder

Hint text shown when the field is empty. Defaults to "", which renders no placeholder region at all.

modifier

Modifier applied to the enclosing Column root.

minLines

Minimum visible lines. Defaults to 1. Ignored when singleLine is true.

maxLines

Maximum lines before scrolling. Defaults to 1 when minLines is 1, otherwise Int.MAX_VALUE. Ignored when singleLine is true.

isError

When true, the field renders its error indicator color. Independent of errorMessage.

errorMessage

Error text displayed below the field in the error color. Ignored when supportingContent is provided.

leadingIcon

Optional icon slot at the start of the field.

trailingIcon

Optional icon slot at the end of the field.

textStyle

Typography for the input text. Defaults to MaterialTheme.typography.bodyLarge.

shape

Shape of the field container. Defaults to TextFieldDefaults.shape.

colors

Color scheme for the field. Defaults to TextFieldDefaults.colors(), the filled-field scheme.

enabled

When false, the field rejects input and renders in Material's disabled color scheme. Defaults to true.

readOnly

When true, the field displays its text without allowing edits. Defaults to false.

keyboardOptions

Software keyboard options (keyboard type, capitalization, IME action) for the field.

keyboardActions

Software keyboard action handlers for the field.

visualTransformation

Visual transformation applied to the input text (e.g. password masking). Defaults to VisualTransformation.None.

singleLine

When true, forces single-line mode: minLines and maxLines are set to 1 and the field scrolls horizontally instead of wrapping. When false (default), single-line mode is derived from minLines and maxLines as before.

interactionSource

The MutableInteractionSource for the field, used to observe focus/press/hover interactions. When null, an internal one is remembered.

prefix

Optional slot rendered inline before the input text (e.g. a currency symbol).

suffix

Optional slot rendered inline after the input text (e.g. a unit).

supportingContent

Optional slot rendered below the field, replacing errorMessage when provided. Use this for counters and helper text.

See also