State of Compose 2023 results are in! Click here to learn more

← Back to Material Compose

RadioButton

Component
in
Material
. Since 0.1.0-dev15

Overview

Code Examples

<a href="https://material.io/components/radio-buttons" class="external" target="_blank">Material Design radio button</a>.

Radio buttons allow users to select one option from a set.

!Radio buttons image(https://developer.android.com/images/reference/androidx/compose/material/radio-buttons.png)

Overloads

RadioButton

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

Parameters

NameDescription
selectedwhether this radio button is selected or not
onClickcallback to be invoked when the RadioButton is clicked. If null, then this RadioButton will not handle input events, and only act as a visual indicator of selected state
modifierModifier to be applied to the radio button
enabledControls the enabled state of the RadioButton. When false, this button will not be selectable and appears disabled
interactionSourcethe MutableInteractionSource representing the stream of Interactions for this RadioButton. You can create and pass in your own remembered MutableInteractionSource if you want to observe Interactions and customize the appearance / behavior of this RadioButton in different Interactions.
colorsRadioButtonColors that will be used to resolve the color used for this RadioButton in different states. See RadioButtonDefaults.colors