RadioButton
RadioButton renders the selected state of one option.
The application owns group exclusivity by storing one selected value.
Model one selected value
Section titled “Model one selected value”const Mode current = mode;
Column { RadioButton("Automatic", current == Mode::Automatic) .OnChanged([mode](bool selected) { if (selected) { mode = Mode::Automatic; } }), RadioButton("Manual", current == Mode::Manual) .OnChanged([mode](bool selected) { if (selected) { mode = Mode::Manual; } }),}.With(Spacing(8.0F))Construct it with bool or State<bool>, optionally preceded by a StringVariant label.
Do not keep a separate boolean state for every option when one enum or identifier describes the group more accurately.
Interaction and theme
Section titled “Interaction and theme”RadioButtonStyle controls geometry, selected and unselected colors, disabled colors, border, inner dot, state layer, and transition duration.
The component exposes radio-button role, selected state, label, focus, and activation semantics.
- Constructors:
RadioButton(bool|State<bool>)andRadioButton(StringVariant, bool|State<bool>). - Event:
.OnChanged(function)withbool. - Theme style:
RadioButtonStyle.
For a compact fixed group with one selected index, use SegmentedButton.
Selection and keyboard boundaries
Section titled “Selection and keyboard boundaries”The four constructors in <huxerui/view.h> take an optional leading StringVariant followed by bool or const State<bool>&. Activating an unselected radio button emits OnChanged(true); activating an already-selected button does not deselect it. Keep the guard in the handler so group policy remains explicit.
The component owns individual focus and activation. It does not register neighboring radios as a group or supply group-level arrow-key navigation. For an unlabeled radio, supply a semantic label. For enum-backed State, first read const Mode current = mode; and compare current; do not rely on overload resolution for State<Mode> == Mode.
RadioButtonStyle fields
Section titled “RadioButtonStyle fields”size is the visible ring size; minimum_interactive_size and state_layer_size control the hit target and feedback separately. selected_color and unselected_color have independent disabled_selected_color / disabled_unselected_color counterparts. border_width controls the ring and dot_radius the selected dot. animation_duration is in seconds.
Material reserves a larger interactive area around the visible radio than the compact Flat baseline. Selection behavior stays controlled under either theme.

