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

← Back to Wear Material Core

RadioButton

Component
in
Wear Material Core
. Since 1.3.0-alpha02

Overview

Code Examples

Video

RadioButton provides an animated radio button for use in material APIs.

@param modifier Modifier to be applied to the radio button. This can be used to provide a content description for accessibility. @param selected Boolean flag indicating whether this radio button is currently toggled on. @param enabled Boolean flag indicating the enabled state of the RadioButton (affects the color). @param ringColor Composable lambda from which the ring color of the radio button will be obtained. @param dotColor Composable lambda from which the dot color of the radio button will be obtained. @param 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. @param interactionSource When also providing onClick, the MutableInteractionSource representing the stream of Interactions for the "toggleable" tap area - can be used to customise the appearance / behavior of the RadioButton. @param dotRadiusProgressDuration Duration of the dot radius progress animation. @param dotAlphaProgressDuration Duration of the dot alpha progress animation. @param dotAlphaProgressDelay Delay for the dot alpha progress animation. @param easing Animation spec to animate the progress. @param width Width of the radio button. @param height Height of the radio button.

Overloads

RadioButton

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Composable
fun RadioButton(
    modifier: Modifier,
    selected: Boolean,
    enabled: Boolean,
    ringColor: @Composable (enabled: Boolean, checked: Boolean) -> State<Color>,
    dotColor: @Composable (enabled: Boolean, checked: Boolean) -> State<Color>,
    onClick: (() -> Unit)?,
    interactionSource: MutableInteractionSource,
    dotRadiusProgressDuration: FunctionDotRadiusProgressDuration,
    dotAlphaProgressDuration: Int,
    dotAlphaProgressDelay: Int,
    easing: CubicBezierEasing,
    width: Dp,
    height: Dp
)

Parameters

NameDescription
modifierModifier to be applied to the radio button. This can be used to provide a content description for accessibility.
selectedBoolean flag indicating whether this radio button is currently toggled on.
enabledBoolean flag indicating the enabled state of the RadioButton (affects the color).
ringColorComposable lambda from which the ring color of the radio button will be obtained.
dotColorComposable lambda from which the dot color of the radio button will be obtained.
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.
interactionSourceWhen also providing onClick, the MutableInteractionSource representing the stream of Interactions for the "toggleable" tap area - can be used to customise the appearance / behavior of the RadioButton.
dotRadiusProgressDurationDuration of the dot radius progress animation.
dotAlphaProgressDurationDuration of the dot alpha progress animation.
dotAlphaProgressDelayDelay for the dot alpha progress animation.
easingAnimation spec to animate the progress.
widthWidth of the radio button.
heightHeight of the radio button