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
selected | Boolean flag indicating whether this radio button is currently toggled on. |
modifier | Modifier to be applied to the radio button. This can be used to provide a content description for accessibility. |
colors | ToggleChipColors from which the toggleControlColors will be obtained. |
enabled | Boolean flag indicating the enabled state of the RadioButton (affects the color). |
onClick | Callback 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 ). |
interactionSource | When also providing onClick , an optional hoisted MutableInteractionSource for observing and emitting Interaction s 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. |