Stylish Form Text Field
An outlined text field designed for form input, with built-in label, placeholder, and error-message support. Wraps Material's OutlinedTextField inside a Column and fills the available width.
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 outline color.
A character counter can be added by passing a counter composable via supportingContent (e.g. { Text("${value.length} / 100") }); no counter is added automatically.
Parameters
Current text value (controlled state).
Called with the updated text on every edit.
Label displayed above the field. Defaults to "", which renders no label region at all. Overridden by labelContent when provided.
Hint text shown when the field is empty. Defaults to "", which renders no placeholder region at all. Overridden by placeholderContent when provided.
Minimum visible lines. Defaults to 1. Ignored when singleLine is true.
Maximum lines before scrolling. Defaults to 1 when minLines is 1, otherwise Int.MAX_VALUE. Ignored when singleLine is true.
When true, the field renders its error outline color. Independent of errorMessage.
Error text displayed below the field in the error color. Ignored when supportingContent is provided.
Optional icon slot at the start of the field.
Optional icon slot at the end of the field.
Typography for the input text. Defaults to MaterialTheme.typography.bodyLarge.
Shape of the outlined border. Defaults to OutlinedTextFieldDefaults.shape.
Color scheme for the field. Defaults to OutlinedTextFieldDefaults.colors(), with the cursor color derived from cursorBrush when it is a solid color.
When false, the field rejects input and renders in Material's disabled color scheme. Defaults to true.
When true, the field displays its text without allowing edits. Defaults to false.
Software keyboard options (keyboard type, capitalization, IME action) for the field.
Software keyboard action handlers for the field.
Visual transformation applied to the input text (e.g. password masking). Defaults to VisualTransformation.None.
Optional slot that replaces the default Text placeholder built from placeholder.
Optional slot rendered below the field, replacing errorMessage when provided. Use this for counters and helper text.
Modifier applied to the inner OutlinedTextField, before fillMaxWidth in the modifier chain (i.e. fieldModifier.fillMaxWidth()). Use this to add test tags or input-specific modifiers without affecting the outer Column.
Brush used for the text cursor. Defaults to SolidColor of Color.Black. Note: Material's string-based OutlinedTextField derives the cursor from its colors' cursorColor, so a SolidColor brush is honored through the default colors, while non-solid brushes fall back to the theme cursor color; an explicit colors overrides the brush.
The MutableInteractionSource for the field, used to observe focus/press/hover interactions. When null, an internal one is remembered.
Optional slot rendered inline before the input text (e.g. a currency symbol).
Optional slot rendered inline after the input text (e.g. a unit).