-
Notifications
You must be signed in to change notification settings - Fork 9
Component ToggleButton
MeowLynxSea edited this page Jun 18, 2026
·
5 revisions
A button with a "selected" state. Like Button plus selected(bool) and on_toggle(bool, …).
use yororen_ui::headless::toggle_button::toggle_button;
toggle_button("bold", cx)
.caption("B")
.selected(self.bold)
.on_toggle({
let entity = cx.entity();
move |new, _, cx| entity.update(cx, |s, _| s.bold = new);
})
.render(cx)| Method | Purpose |
|---|---|
caption(text) |
Button label. |
icon(source) |
Optional leading IconSource. |
icon_size(px) |
Size of the leading icon. |
caption_icon(text, source) |
Set both caption and icon in one call. |
variant(v) |
ActionVariantKind. |
selected(v) |
Current toggled state. |
disabled(v) |
Disable the toggle. |
on_toggle(closure) |
Fn(bool, &mut Window, &mut App) + 'static + Send + Sync. |
.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.