androidx.compose.material3
RadioButton
Composable function
A radio button selects one option from a set. Selecting one deselects the others. Use radio buttons when the user should see all options at once. For many options, use a menu instead.
A radio button does not know about the others. You keep the selected option in a variable.

val options = listOf("Small", "Medium", "Large")
var selected by remember { mutableStateOf("Medium") }
Column(Modifier.selectableGroup()) {
options.forEach { option ->
Row(
modifier = Modifier
.width(200.dp)
.selectable(selected = option == selected, onClick = { selected = option }, role = Role.RadioButton),
verticalAlignment = Alignment.CenterVertically,
) {
// The Row handles clicks, so the radio button itself does not.
RadioButton(selected = option == selected, onClick = null)
Text(option, Modifier.padding(start = 8.dp))
}
}
}

Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
RadioButton(selected = true, onClick = {})
RadioButton(selected = false, onClick = {})
RadioButton(selected = true, onClick = {}, enabled = false)
RadioButton(selected = false, onClick = {}, enabled = false)
}
Parameters
@Composable
fun RadioButton(
selected: Boolean,
onClick: (() -> Unit)?,
modifier: Modifier = Modifier,
enabled: Boolean = true,
colors: RadioButtonColors = RadioButtonDefaults.colors(),
interactionSource: MutableInteractionSource? = null,
)
selected: BooleanRequired
selected: BooleanRequiredWhether this option is selected. Usually option == selectedOption.
onClick: (() -> Unit)?Required
onClick: (() -> Unit)?RequiredCalled when the user clicks. Set your state to this option here.
Pass null if a whole row handles the click. This makes the label clickable too, as in the first example.
Also add Modifier.selectableGroup() to the parent, so screen readers treat the options as one group.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position of the radio button. See the Modifier guide.
enabled: BooleanOptional
enabled: BooleanOptionalDefault: true
Set to false to make the radio button gray and not clickable.
colors: RadioButtonColorsOptional
colors: RadioButtonColorsOptionalDefault: RadioButtonDefaults.colors()
Sets the colors for selected, unselected and disabled.
Make one with RadioButtonDefaults.colors.

RadioButton(
selected = true,
onClick = {},
colors = RadioButtonDefaults.colors(selectedColor = MaterialTheme.colorScheme.tertiary),
)
interactionSource: MutableInteractionSource?Optional
interactionSource: MutableInteractionSource?OptionalDefault: null
Lets you observe or control press, hover and focus states. Leave it null unless your code must react to them. See InteractionSource.
See also
RadioButtonDefaults: default values and helper functions forRadioButton.