Skip to content

Textarea ​

A labeled multiline text input. It shares the label / help / error chrome of TextField; the control is sized by minLines. Use it for longer free-form text such as comments or bios.

Import ​

kotlin
import io.github.heartcoolman.prism.ui.PrismTextarea

Basic usage ​

kotlin
var bio by remember { mutableStateOf("") }
PrismTextarea(
    value = bio,
    onValueChange = { bio = it },
    label = "Bio",
    placeholder = "Tell us about yourself…",
    minLines = 3,
)

States ​

A non-empty error styles the border and message in danger and replaces helpText. enabled = false renders the disabled style. fullWidth stretches the control to the container width.

kotlin
// Error
PrismTextarea(
    value = bio,
    onValueChange = { bio = it },
    label = "Notes",
    error = "This field is required.",
)

// Disabled, full width
PrismTextarea(
    value = bio,
    onValueChange = { bio = it },
    label = "Locked",
    enabled = false,
    fullWidth = true,
)

API ​

ParameterTypeDefaultDescription
valueString—Current text value.
onValueChange(String) -> Unit—Called with the new value on each edit.
modifierModifierModifierLayout modifier applied to the column.
labelString?nullLabel rendered above the field.
placeholderString?nullPlaceholder shown when the value is empty.
helpTextString?nullSupporting text shown below when not in error.
errorString?nullError message; non-empty switches the field to its error state and replaces helpText.
enabledBooleantrueWhether the field accepts input.
minLinesInt4Minimum number of visible text lines.
maxLinesIntInt.MAX_VALUEMaximum number of visible text lines.
fullWidthBooleanfalseStretch the field to fill the container width.

Released under the MIT License.