Skip to content

Component Icon

MeowLynxSea edited this page Jun 13, 2026 · 6 revisions

Icon

A headless icon. The renderer decides how to draw IconSource (an inline SVG, a font glyph, or a remote asset).

Import

use yororen_ui::headless::icon::icon;

Minimal example

use yororen_ui::headless::icon::icon;
use yororen_ui::renderer::IconSource;

icon("save-icon", IconSource::Named("check".into()), cx)
    .size(px(16.0))
    .render(cx)

Props

Method Purpose
size(px) Render size (the renderer decides intrinsic vs container scaling).
color(hsla) Tint color (the renderer may ignore this for multi-color icons).

The factory's second argument is the IconSource (e.g. IconSource::Named("check".into())).

Notes

  • Factory takes (id, source, _cx).
  • IconSource lives in yororen_ui::renderer (re-exported from headless). The exact variants depend on the renderer in use.
  • .render(cx) returns AnyElement. Use icon(...).into_any_element()-style composition if you need to embed it inside a Div child slot.

See also

Avatar, Badge, IconButton

Clone this wiki locally