Skip to content

Component IconButton

MeowLynxSea edited this page Jun 13, 2026 · 5 revisions

IconButton

A square button that holds an icon instead of a caption.

Import

use yororen_ui::headless::icon_button::icon_button;

Minimal example

use yororen_ui::headless::icon_button::icon_button;
use yororen_ui::renderer::IconSource;

icon_button("close-btn", cx)
    .icon(IconSource::Named("x".into()))
    .on_click(|_, _window, _cx| {
        // close
    })
    .render(cx)

Props

Method Purpose
icon(source) The IconSource to render.
icon_size(px) Size of the icon (the button pads around it).
variant(v) One of the ActionVariantKind values.
disabled(v) Disable interaction.
on_click(closure) Fn(&ClickEvent, &mut Window, &mut App) + 'static + Send + Sync.

Notes

  • Factory takes (id, cx). The cx is needed for the focus handle.
  • No state entity. Capture self with cx.entity().clone().
  • .render(cx) returns Stateful<Div>.

See also

Button, ToggleButton, Icon

Clone this wiki locally