RadioGroup

fun RadioGroup(state: RadioGroupState, contentDescription: String?, modifier: Modifier = Modifier, content: @Composable RadioGroupScope.() -> Unit)

A foundational component used to build radio groups.

For interactive preview & code examples, visit Radio Group Documentation.

Basic Example

val radioGroupState = rememberRadioGroupState("option1")

RadioGroup(state = radioGroupState, contentDescription = "Options") {
Radio(
value = "option1",
shape = CircleShape,
backgroundColor = Color.White,
borderColor = Color(0xFFE4E4E4),
borderWidth = 1.dp
) {
Text("Option 1")
}
Radio(
value = "option2",
shape = CircleShape,
backgroundColor = Color.White,
borderColor = Color(0xFFE4E4E4),
borderWidth = 1.dp
) {
Text("Option 2")
}
}

Parameters

state

The RadioGroupState that controls the selected option.

contentDescription

The content description for accessibility.

modifier

Modifier to be applied to the radio group.

content

The content of the radio group, which should contain multiple Radio components.