Skip to content

Component Radio

MeowLynxSea edited this page Jun 18, 2026 · 6 revisions

Radio

A single radio button. Use inside a RadioGroup for an exclusive selection.

use yororen_ui::headless::radio::radio;

radio("theme-dark", cx)
    .checked(self.theme == "dark")
    .on_toggle({
        let entity = cx.entity();
        move |_, _, cx| entity.update(cx, |s, _| s.theme = "dark".into());
    })
    .render(cx)

Props

Method Purpose
checked(v) Whether this radio is the active one in its group.
disabled(v) Disable the toggle.
on_toggle(closure) Fn(bool, &mut Window, &mut App) + 'static + Send + Sync.
has_custom_tone(v) / custom_tone(hsla) Override accent color.

Factory takes (id, cx). .render(cx) returns Stateful<Div>. No state entity.

See also: RadioGroup, Checkbox, Switch.

Clone this wiki locally