JengaRadioListItem

fun JengaRadioListItem(headline: String, selected: Boolean, onClick: () -> 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, radioSize: Dp = JengaSelectionListItemDefaults.radioSize, colors: JengaListItemColors = JengaSelectionListItemDefaults.colors(), trailingContent: @Composable () -> Unit? = null)(source)

A list row with a JengaRadioButton, for picking one option from a list. The whole row is the touch target and is announced as a radio button.

Parameters

headline

the option label.

selected

whether this option is the selected one.

onClick

called 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 radio 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.

radioSize

the diameter of the radio.

colors

the row color set (e.g. a warning-colored supporting line); defaults to JengaSelectionListItemDefaults.colors.

trailingContent

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

Samples

var selected by remember {
    mutableIntStateOf(
        value = 0,
    )
}
Column(
    content = {
        JengaRadioListItem(
            headline = "Repair",
            selected = selected == 0,
            onClick = { selected = 0 },
        )
        JengaRadioListItem(
            headline = "Replace",
            selected = selected == 1,
            onClick = { selected = 1 },
        )
    },
)