# SingleChoiceSegmentedButtonRow

> SingleChoiceSegmentedButtonRow from Material 3 Compose (`androidx.compose.material3:material3`) for Jetpack Compose, with a code sample.

- Library: [Material 3 Compose](https://composables.com/material-components/material-3-compose.md)
- Category: [Buttons](https://composables.com/material-components/buttons.md)
- API reference and more examples: [SingleChoiceSegmentedButtonRow](https://composables.com/jetpack-compose/androidx.compose.material3/material3/components/SingleChoiceSegmentedButtonRow/api.md)

## Code

```kotlin
@Composable

fun SegmentedButtonSingleSelectSample() {
    var selectedIndex by rememberSaveable { mutableStateOf(0) }
    val options = listOf("Day", "Month", "Week")
    SingleChoiceSegmentedButtonRow {
        options.forEachIndexed { index, label ->
            SegmentedButton(
                shape = SegmentedButtonDefaults.itemShape(index = index, count = options.size),
                onClick = { selectedIndex = index },
                selected = index == selectedIndex,
            ) {
                Text(label)
            }
        }
    }
}
```
