Extra
SegmentedButton
A FormaUI segmented button row — a set of connected, mutually-styled buttons for view switching or option selection, delegating to Material 3's SingleChoiceSegmentedButtonRow / MultiChoiceSegmentedButtonRow.
dev.formaui.components.segmentedbutton
single-selectmulti-select
Preview
This toggle is site chrome only — the preview has its own light/dark switch inside.
Live preview
Live preview — ~37 MB development build
Usage
var selectedPeriod by remember { mutableStateOf(0) }
val periods = listOf("Day", "Week", "Month")
FormaSegmentedButtonRow(multiSelect = false) {
periods.forEachIndexed { index, label ->
FormaSegmentedButton(
selected = selectedPeriod == index,
onClick = { selectedPeriod = index },
index = index,
count = periods.size,
label = { Text(label) },
)
}
}Supporting API
- FormaSegmentedButtonRowScopeclass
- Interface (scope) extending both SingleChoiceSegmentedButtonRowScope and MultiChoiceSegmentedButtonRowScope so one content lambda type serves both selection modes.
Accessibility
Single-select segments carry RadioButton semantics and multi-select segments carry toggle semantics, via the correctly-scoped Material 3 SegmentedButton overloads.