Radio Group

A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.

Basic Usage

RadioGroup is a layout container that arranges RadioButtonWithLabel items. Both components are generic — value and selectedValue can be any type T, including String, enum, or a data class.

Horizontal

Set orientation = LayoutOrientation.Horizontal to arrange the radio buttons in a row with 16 dp spacing.

API Reference

RadioGroup<T>

ParameterTypeDefaultDescription
selectedValueTThe currently selected value in the group.
onValueChange(T) -> UnitCallback invoked when the selection changes.
modifierModifierModifierModifier applied to the layout container.
orientationLayoutOrientationLayoutOrientation.VerticalArranges children vertically (Column) or horizontally (Row).
content@Composable () -> UnitThe radio button items — typically RadioButtonWithLabel composables.

RadioButtonWithLabel<T>

ParameterTypeDefaultDescription
valueTThe value this radio button represents.
labelStringText label displayed next to the radio button.
selectedValueTThe currently selected value from the parent group. Used to derive the checked state.
onValueChange(T) -> UnitCallback invoked when this radio button is selected.
modifierModifierModifierModifier applied to the row container.
enabledBooleantrueWhen false, the button and label are non-interactive and rendered in muted colors.
colorsRadioButtonColors?nullCustom Material3 RadioButtonColors. When null, KomoUI theme tokens are used automatically.

LayoutOrientation

ValueDescription
VerticalItems stacked in a Column with 16 dp vertical spacing.
HorizontalItems placed in a Row with 16 dp horizontal spacing.

Behaviour notes

  • The entire row (radio button + label) is selectable via Modifier.selectable with Role.RadioButton for correct accessibility semantics.
  • RadioButton inside the row has onClick = null — the click is handled by the row's selectable modifier, preventing double-tap regions.
  • The label text color switches to mutedForeground automatically when enabled = false.
Edit this page on GitHub