I would like to add a gender selection input to my application's form. The first component that came to mind was SingleChoiceSegmentedButtonRow, so I checked its documentation.
There, I found the following message (August 3, 2026):
I followed the link to the Button groups page.
However, I am having trouble finding the relevant documentation for this component. The page redirects me to the list of all Material 3 components instead of the documentation for button groups.
Could someone point me to the correct documentation or provide an example implementation of a single-choice input using a Connected Button Group?
@Composable
fun GenderSelector() {
val options = listOf("Male", "Female", "Other")
var selectedIndex by rememberSaveable { mutableIntStateOf(0) }
SingleChoiceSegmentedButtonRow {
options.forEachIndexed { index, label ->
SegmentedButton(
selected = selectedIndex == index,
onClick = { selectedIndex = index },
shape = SegmentedButtonDefaults.itemShape(
index = index,
count = options.size
),
label = {
Text(label)
}
)
}
}
}
Suraj Bahadur