Vertical

fun Vertical(selectedIndex: Int, modifier: Modifier = Modifier, role: Role = SegmentedControlDefaults.SemanticRole, enabled: Boolean = true, shape: SegmentedControlShape = SegmentedControlShape.Rounded, indicatorContent: @Composable (selectedIndex: Int, enabled: Boolean) -> Unit = { _, enabled -> SegmentedControlDefaults.Indicator(shape = shape.shape, enabled = enabled) }, content: @Composable SegmentedControlScope.(SegmentedButtonItem) -> Unit)(source)

Two-row segmented control for 4–8 segments.

Segments are distributed across two rows, segments are indexed sequentially across both rows, so index 0 is the first segment in row 0 and index ceil(n/2) is the first segment in row 1.

Parameters

selectedIndex

Zero-based index of the currently selected segment across both rows. Must be in 0 until segmentCount; throws IllegalArgumentException otherwise.

modifier

Modifier applied to the outermost Column that wraps the optional header and the control track.

role

The Role used for the segments. Defaults to Role.RadioButton to represent single selection but if you use the SegmentedControl to completely change the layout use bellow it then use Role.Tab

enabled

When false all segments ignore input and their ripple is suppressed.

shape

Shape applied to each segment's touch target and to the animated indicator. Defaults to SegmentedControlShape.Rounded. Use SegmentedControlShape.Pill for a fully rounded look.

indicatorContent

Composable that draws the selection indicator. Receives the current selectedIndex so callers can vary the appearance per selection — useful for value scales such as energy ratings. Defaults to SegmentedControlDefaults.Indicator using shape.

content

Segment declarations using SegmentedControlScope. Every call to a scope function adds one segment; call them in display order. Requires 4–8 calls.