JengaChip

fun JengaChip(label: String, selected: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, leadingIcon: @Composable () -> Unit? = null, shape: Shape = JengaChipDefaults.shape, colors: JengaChipColors = JengaChipDefaults.colors(), trailingContent: @Composable () -> Unit? = null, textStyle: TextStyle = JengaChipDefaults.textStyle, selectedTextStyle: TextStyle = textStyle.merge(JengaTheme.components.chip?.selectedTextStyle), minHeight: Dp = JengaTheme.components.chip?.minHeight ?: JengaChipDefaults.MinHeight, contentPadding: PaddingValues = JengaChipDefaults.contentPadding, iconSpacing: Dp = JengaChipDefaults.iconSpacing)(source)

A compact, toggleable chip for filters and selections.

Parameters

label

the chip text.

selected

whether the chip is currently selected.

onClick

called when the chip is tapped.

modifier

the Modifier for this chip.

enabled

whether the chip is interactive.

leadingIcon

optional icon before the label (inherits the content color).

shape

the chip shape; defaults to JengaChipDefaults.shape.

colors

the color set; defaults to JengaChipDefaults.colors.

trailingContent

optional slot after the label (e.g. a count); inherits the content color.

textStyle

the label text style.

selectedTextStyle

the label text style while selected; defaults to textStyle with the theme's JengaChipStyle.selectedTextStyle merged on top.

minHeight

the minimum visual height; defaults to the theme's JengaChipStyle.minHeight, else JengaChipDefaults.MinHeight.

contentPadding

padding inside the chip.

iconSpacing

the gap between the leading icon, the label and the trailing content.

Samples

var selected by remember {
    mutableStateOf(
        value = false,
    )
}
JengaChip(
    label = "Music",
    selected = selected,
    onClick = { selected = !selected },
)