-
Notifications
You must be signed in to change notification settings - Fork 9
Component RadioGroup
MeowLynxSea edited this page Jun 18, 2026
·
4 revisions
A wrapper that ensures exactly one Radio child is selected. The parent owns selected and the radios.
use yororen_ui::headless::radio::radio;
use yororen_ui::headless::radio_group::radio_group;
radio_group("theme", cx)
.name("theme")
.selected(self.theme_idx)
.on_change({
let entity = cx.entity();
move |new, _, cx| entity.update(cx, |s, _| s.theme_idx = new);
})
.child(radio("theme-light", cx).checked(self.theme_idx == 0).render(cx))
.child(radio("theme-dark", cx).checked(self.theme_idx == 1).render(cx))
.render(cx)| Method | Purpose |
|---|---|
name(s) |
Group name. Drives Tab order dedupe and a11y. |
selected(i) |
Index of the currently selected radio. |
on_change(closure) |
Fn(usize, &mut Window, &mut App) + 'static + Send + Sync. Fired with the new index. |
child(stateful) |
A rendered Radio element. |
Each child's own on_toggle is overridden by the group's selection.
.render(cx) returns Stateful<Div>. No state entity.
Yororen UI v0.3.0 · repository · Apache-2.0 · This wiki documents Yororen UI v0.3.0.
This wiki documents Yororen UI v0.3.0 — the headless-core, swappable-renderer build.