Browse documentation
Documentation

Iconify icons

Edit this guide on GitHub

Creates an IconData expression for one icon from a staged Iconify set. The result can be assigned to a constant.

use hearth::icon::IconData;

const DELETE: IconData = iconify::iconify_icon!("mdi:delete");

Pass a "set:icon" reference. The icon name can be an alias. You can also use the macro directly in a view:

view! {
    icon(data: iconify::iconify_icon!("mdi:delete"))
}

Unknown sets or icons cause a compile error with suggestions for similar names. Icons with rotation or flip properties are not supported.

Staging

Stage the set from build.rs with BuildConfig. It downloads missing sets and reuses cached copies:

// build.rs
fn main() {
    hearth::icon::iconify::BuildConfig::new()
        .icon_set("mdi")
        .stage()
        .unwrap();
}

Whole sets

Use include! to generate named constants for an icon set.