RadioButton

Composable Component

RadioButton provides an animated radio button for use as a toggle control in ToggleChip or SplitToggleChip.

Android
@Composable
public fun RadioButton(
    selected: Boolean,
    modifier: Modifier = Modifier,
    colors: RadioButtonColors = RadioButtonDefaults.colors(),
    enabled: Boolean = true,
    onClick: (() -> Unit)? = null,
    interactionSource: MutableInteractionSource? = null,
): Unit

Parameters

selectedBoolean flag indicating whether this radio button is currently toggled on.
modifierModifier to be applied to the radio button. This can be used to provide a content description for accessibility.
colorsToggleChipColors from which the toggleControlColors will be obtained.
enabledBoolean flag indicating the enabled state of the RadioButton (affects the color).
onClickCallback to be invoked when RadioButton is clicked. If null, then this is passive and relies entirely on a higher-level component to control the state (such as ToggleChip or SplitToggleChip).
interactionSourceWhen also providing onClick, an optional hoisted MutableInteractionSource for observing and emitting Interactions for this radio button. You can use this to change the radio button's appearance or preview the radio button in different states. Note that if null is provided, interactions will still happen internally.