androidx.compose.material3

MultiChoiceSegmentedButtonRow

Composable function

One of the rows and buttons. It works like SingleChoiceSegmentedButtonRow. Only the parameters that differ are described here.

A row where more than one button can be on at once.

Pick several options
Pick several options
val options = listOf("Walk", "Bike", "Car")
val checked = remember { mutableStateListOf(true, false, true) }
MultiChoiceSegmentedButtonRow {
    options.forEachIndexed { index, label ->
        SegmentedButton(
            checked = checked[index],
            onCheckedChange = { checked[index] = it },
            shape = SegmentedButtonDefaults.itemShape(index = index, count = options.size),
        ) { Text(label) }
    }
}

Parameters

@Composable
fun MultiChoiceSegmentedButtonRow(
    modifier: Modifier = Modifier,
    space: Dp = SegmentedButtonDefaults.BorderWidth,
    content: @Composable MultiChoiceSegmentedButtonRowScope.() -> Unit,
)

content: @Composable MultiChoiceSegmentedButtonRowScope.() -> UnitRequired

The buttons. Add one SegmentedButton per option.

Same as in SingleChoiceSegmentedButtonRow: modifier, space.

Rows and buttons