🌈 Create new beautiful Compose Gradients with our new wesite ->

RadioButton

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 })
    }
}