# RadioButton

> RadioButton from Material Compose (`androidx.compose.material:material`) for Jetpack Compose, with a code sample.

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

## Code

```kotlin
@Composable
fun RadioButtonSample() {
    // We have two radio buttons and only one can be selected
    var state by remember { mutableStateOf(true) }
    // Note that Modifier.selectableGroup() is essential to ensure correct accessibility behavior
    Row(Modifier.selectableGroup()) {
        RadioButton(selected = state, onClick = { state = true })
        RadioButton(selected = !state, onClick = { state = false })
    }
}
```
