New Compose Multiplatform components arrived on Composables UICheck it out →

Component in Tv Material Compose

RadioButton

Android

Material Design radio button.

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

Last updated:

Installation

dependencies {
   implementation("androidx.tv:tv-material:1.0.0-beta01")
}

Overloads

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

Parameters

namedescription
selectedwhether this radio button is selected or not
onClickcalled when this radio button is clicked. If null, then this radio button will not be interactable, unless something else handles its input events and updates its state.
modifierthe [Modifier] to be applied to this radio button
enabledcontrols the enabled state of this radio button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
colors[RadioButtonColors] that will be used to resolve the color used for this radio button in different states. See [RadioButtonDefaults.colors].
interactionSourcean 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.

Code Example

RadioButtonSample

@Composable
@Sampled
fun RadioButtonSample() {
    RadioButton(selected = true, onClick = {})
}