JengaCheckboxListItem

fun JengaCheckboxListItem(headline: String, checked: Boolean, onCheckedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, supporting: String? = null, enabled: Boolean = true, controlPosition: JengaControlPosition = JengaControlPosition.Leading, minHeight: Dp = JengaSelectionListItemDefaults.minHeight, contentPadding: PaddingValues = JengaSelectionListItemDefaults.contentPadding, contentSpacing: Dp = JengaSelectionListItemDefaults.contentSpacing, headlineStyle: TextStyle = JengaSelectionListItemDefaults.headlineStyle, supportingStyle: TextStyle = JengaSelectionListItemDefaults.supportingStyle, headlineMaxLines: Int = 1, supportingMaxLines: Int = 1, trailingContent: @Composable () -> Unit? = null, checkboxShape: Shape = JengaSelectionListItemDefaults.checkboxShape, colors: JengaListItemColors = JengaSelectionListItemDefaults.colors(), checkboxColors: JengaCheckboxColors = JengaCheckboxDefaults.colors(), loading: Boolean = false)(source)

A list row with a JengaCheckbox, for picking several options from a list. The whole row is the touch target and is announced as a checkbox.

Parameters

headline

the option label.

checked

whether this option is checked.

onCheckedChange

called with the new checked state when the row is tapped.

modifier

the Modifier for this row.

supporting

optional secondary text below the headline.

enabled

whether the row is interactive.

controlPosition

whether the checkbox sits at the start or the end of the row.

minHeight

the minimum row height.

contentPadding

inner padding around the row content.

contentSpacing

the gap between the control and the text.

headlineStyle

the headline text style.

supportingStyle

the supporting text style.

headlineMaxLines

the maximum lines for headline before it is truncated.

supportingMaxLines

the maximum lines for supporting before it is truncated.

trailingContent

optional end slot (e.g. a count), before a trailing control; tapping it toggles the row.

checkboxShape

the checkbox box shape.

colors

the row color set; its disabled colors apply when enabled is false, so a locked row can keep its label in the normal text color while only the box fades.

checkboxColors

the checkbox color set (e.g. a faded checked fill when disabled).

loading

whether a spinner replaces the checkbox (e.g. while the change saves); taps are ignored.

Samples

var checked by remember {
    mutableStateOf(
        value = true,
    )
}
JengaCheckboxListItem(
    headline = "Battery",
    checked = checked,
    onCheckedChange = { checked = it },
)