Radio

fun RadioGroupScope.Radio(value: String, modifier: Modifier = Modifier, backgroundColor: Color = Color.Unspecified, contentColor: Color = Color.Unspecified, selectedColor: Color = Color.Unspecified, enabled: Boolean = true, shape: Shape = RectangleShape, borderColor: Color = Color.Unspecified, borderWidth: Dp = Dp.Unspecified, contentPadding: PaddingValues = NoPadding, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, indication: Indication? = LocalIndication.current, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, verticalAlignment: Alignment.Vertical = Alignment.Top, content: @Composable RowScope.() -> Unit)

A radio button component that can be selected within a RadioGroup.

This is a managed version of this component. It will automatically handle the state for you.

A stateless version is also available within a different overload.

Parameters

value

The value of this radio button.

modifier

Modifier to be applied to the radio button.

backgroundColor

The background color of the radio button.

contentColor

The color of the content when selected.

selectedColor

The color of the content when not selected.

enabled

Whether the radio button is enabled.

shape

The shape of the radio button.

borderColor

The color of the border.

borderWidth

The width of the border.

contentPadding

Padding values for the content.

interactionSource

The interaction source for the radio button.

indication

The indication to be shown when the radio button is interacted with.

horizontalArrangement

The horizontal arrangement of the content.

verticalAlignment

The vertical alignment of the content.

content

The content of the radio button.


fun Radio(selected: Boolean, onSelectedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, backgroundColor: Color = Color.Unspecified, contentColor: Color = Color.Unspecified, selectedColor: Color = Color.Unspecified, enabled: Boolean = true, shape: Shape = RectangleShape, borderColor: Color = Color.Unspecified, borderWidth: Dp = Dp.Unspecified, contentPadding: PaddingValues = NoPadding, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, indication: Indication? = LocalIndication.current, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, verticalAlignment: Alignment.Vertical = Alignment.Top, content: @Composable RowScope.() -> Unit)

A stateless version of Radio component.

There is also a managed version of this component, that will automatically manage its state within a RadioGroup.

Parameters

selected

Whether the radio button is selected.

onSelectedChange

Callback when the selected state changes.

modifier

Modifier to be applied to the radio button.

backgroundColor

The background color of the radio button.

contentColor

The color of the content when selected.

selectedColor

The color of the content when not selected.

enabled

Whether the radio button is enabled.

shape

The shape of the radio button.

borderColor

The color of the border.

borderWidth

The width of the border.

contentPadding

Padding values for the content.

interactionSource

The interaction source for the radio button.

indication

The indication to be shown when the radio button is interacted with.

horizontalArrangement

The horizontal arrangement of the content.

verticalAlignment

The vertical alignment of the content.

content

The content of the radio button.