RadioButton

Composable Component

The Wear Material RadioButton offers slots and a specific layout for an icon, a label and a secondaryLabel. The icon and secondaryLabel are optional. The items are laid out in a row with the optional icon at the start, a column containing the two label slots in the middle and the selection control at the end.

Android
@Composable
public fun RadioButton(
    selected: Boolean,
    onSelect: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shape: Shape = RadioButtonDefaults.radioButtonShape,
    colors: RadioButtonColors = RadioButtonDefaults.radioButtonColors(),
    contentPadding: PaddingValues = RadioButtonDefaults.ContentPadding,
    interactionSource: MutableInteractionSource? = null,
    transformation: SurfaceTransformation? = null,
    icon: @Composable (BoxScope.() -> Unit)? = null,
    secondaryLabel: @Composable (RowScope.() -> Unit)? = null,
    label: @Composable RowScope.() -> Unit,
)

Parameters

selectedBoolean flag indicating whether this button is currently selected.
onSelectCallback to be invoked when this button has been selected by clicking.
modifierModifier to be applied to the RadioButton.
enabledControls the enabled state of the button. When false, this button will not be clickable.
shapeDefines the button's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme.
colorsRadioButtonColors that will be used to resolve the background and content color for this button in different states.
contentPaddingThe spacing values to apply internally between the container and the content.
interactionSourcean 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.
transformationTransformation to be used when button appears inside a container that needs to dynamically change its content separately from the background.
iconAn optional slot for providing an icon to indicate the purpose of the button. The contents are expected to be center-aligned, both horizontally and vertically, and should be an icon of size 24.dp.
secondaryLabelA slot for providing the button's secondary label. The contents are expected to be text which is "start" aligned.
labelA slot for providing the button's main label. The contents are expected to be text which is "start" aligned.