JengaTextArea

fun JengaTextArea(value: String, onValueChange: (String) -> Unit, modifier: Modifier = Modifier, label: String? = null, placeholder: String? = null, status: JengaTextFieldStatus = JengaTextFieldStatus.Default, supportingText: String? = null, maxLength: Int? = null, enabled: Boolean = true, readOnly: Boolean = false, minLines: Int = JengaTextAreaDefaults.MinLines, maxLines: Int = JengaTextAreaDefaults.MaxLines, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions.Default, shape: Shape = JengaTextFieldDefaults.shape, colors: JengaTextFieldColors = JengaTextFieldDefaults.colors(), textStyle: TextStyle = JengaTextFieldDefaults.textStyle, contentPadding: PaddingValues = JengaTextFieldDefaults.contentPadding(singleLine = false), focusRingWidth: Dp = JengaTheme.components.textField?.focusRingWidth ?: JengaTextFieldDefaults.FocusRingWidth)(source)

A multi-line text box for comments, notes, reasons and descriptions. It starts minLines tall, grows up to maxLines as the user types, then scrolls inside itself. Text and placeholder start at the top. The Enter key adds a new line unless keyboardOptions sets an IME action.

With a maxLength, a counter ("120 / 512") sits under the box on the right; typing stops at the limit, pasted text is cut to it, and the counter turns to the error color once the limit is reached.

Parameters

value

the current text.

onValueChange

called when the text changes.

modifier

the Modifier for the whole field (label + box + support).

label

optional label shown above the box.

placeholder

optional hint shown when value is empty.

status

validation status; see JengaTextFieldStatus.

supportingText

optional helper/error text shown below the box.

maxLength

the most characters allowed; null means no limit and no counter.

enabled

whether the box is editable.

readOnly

whether the box is read-only (focusable but not editable).

minLines

lines shown before anything is typed.

maxLines

lines shown before the text scrolls inside the box.

keyboardOptions

software-keyboard configuration.

keyboardActions

IME action handlers.

shape

the box shape; defaults to JengaTextFieldDefaults.shape.

colors

the color set; defaults to JengaTextFieldDefaults.colors.

textStyle

the input and placeholder text style.

contentPadding

padding inside the box.

focusRingWidth

width of the soft focus halo; 0.dp removes it.

Samples

var notes by remember {
    mutableStateOf(
        value = "",
    )
}
JengaTextArea(
    value = notes,
    onValueChange = { notes = it },
    label = "Visit notes",
    placeholder = "What happened on the visit?",
    maxLength = 512,
)