-
Notifications
You must be signed in to change notification settings - Fork 9
Component Button
MeowLynxSea edited this page Jun 13, 2026
·
5 revisions
A standard clickable button with a caption and optional icon. Headless — visuals come from the registered ButtonRenderer.
use yororen_ui::headless::button::button;use yororen_ui::headless::button::button;
button("save-btn", cx)
.caption("Save")
.on_click(|_, _window, _cx| {
// handle click
})
.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) |
Convenience: set both caption and icon in one call. |
variant(v) |
One of the ActionVariantKind values (e.g. Primary, Secondary, Ghost, Danger). |
disabled(v) |
Disable interaction and dim the visuals. |
on_click(closure) |
Fn(&ClickEvent, &mut Window, &mut App) + Send + Sync + 'static. |
The standard Div IntoElement chain (.child(...), .flex(), etc.) is the body of the button — not part of the Props table.
- Factory takes
(id, cx). The id is required for focus tracking. - No
Entity<ButtonState>— click handling is wired inline viaon_click. - The
on_clickclosure must be'static + Send + Sync. Capture self withcx.entity().clone(). -
.render(cx)returnsStateful<Div>.
IconButton, ToggleButton, SplitButton, Form
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.