JengaTextField

fun JengaTextField(value: String, onValueChange: (String) -> Unit, modifier: Modifier = Modifier, label: String? = null, placeholder: String? = null, status: JengaTextFieldStatus = JengaTextFieldStatus.Default, supportingText: String? = null, enabled: Boolean = true, readOnly: Boolean = false, singleLine: Boolean = true, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, visualTransformation: VisualTransformation = VisualTransformation.None, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions.Default, shape: Shape = JengaTextFieldDefaults.shape, colors: JengaTextFieldColors = JengaTextFieldDefaults.colors(), textStyle: TextStyle = JengaTextFieldDefaults.textStyle, minHeight: Dp = JengaTextFieldDefaults.minHeight(singleLine), contentPadding: PaddingValues = JengaTextFieldDefaults.contentPadding(singleLine), focusRingWidth: Dp = JengaTheme.components.textField?.focusRingWidth ?: JengaTextFieldDefaults.FocusRingWidth)(source)

A single- or multi-line text input.

Built on Compose Foundation's BasicTextField, so its look is governed entirely by Jenga tokens. The border reflects focus and status; an optional supportingText sits below and is colored to match the status.

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 field.

placeholder

optional hint shown when value is empty.

status

validation status; see JengaTextFieldStatus.

supportingText

optional helper/error text shown below the field.

enabled

whether the field is editable.

readOnly

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

singleLine

whether the field is constrained to one line.

leadingIcon

optional icon at the start (inherits the content color).

trailingIcon

optional icon at the end (inherits the content color).

visualTransformation

transforms the displayed text (e.g. password).

keyboardOptions

software-keyboard configuration.

keyboardActions

IME action handlers.

shape

the field shape; defaults to JengaTextFieldDefaults.shape.

colors

the color set; defaults to JengaTextFieldDefaults.colors.

textStyle

the input and placeholder text style.

minHeight

the minimum height of the input box.

contentPadding

padding inside the input box.

focusRingWidth

width of the soft focus halo; 0.dp removes it. Defaults to the theme's JengaTextFieldStyle.focusRingWidth, else JengaTextFieldDefaults.FocusRingWidth.

Samples

var value by remember {
    mutableStateOf(
        value = "",
    )
}
JengaTextField(
    value = value,
    onValueChange = { value = it },
    label = "Ticket code",
    placeholder = "TKT-…",
)