-
Notifications
You must be signed in to change notification settings - Fork 9
Component Checkbox
MeowLynxSea edited this page Jun 13, 2026
·
6 revisions
A boolean toggle. Headless — visuals come from the registered CheckboxRenderer.
use yororen_ui::headless::checkbox::checkbox;use yororen_ui::headless::checkbox::checkbox;
let checked = self.agreed;
checkbox("tos", cx)
.checked(checked)
.on_toggle({
let entity = cx.entity();
move |new: bool, _window, cx| {
entity.update(cx, |s, _cx| s.agreed = new);
}
})
.render(cx)| Method | Purpose |
|---|---|
checked(v) |
Current checked state. |
disabled(v) |
Disable interaction. |
on_toggle(closure) |
Fn(bool, &mut Window, &mut App) + 'static + Send + Sync. Fired with the new value. |
has_custom_tone(v) |
Tell the renderer the caller overrode the accent color. |
custom_tone(hsla) |
Override the rendered accent color. |
- Factory takes
(id, cx). Thecxis needed so the renderer can mint the focus handle. - No
Entity<CheckboxState>— toggle handling is wired inline. - Capture self in the callback with
cx.entity().clone()and update the view throughentity.update(cx, |s, _cx| { ... }). -
.render(cx)returnsStateful<Div>.
Switch, Radio, RadioGroup, ToggleButton
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.