This page adds an icon set crate to a Rust project and registers it with oxblade-icons.
Install
Add the renderer and the set crates you want:
[dependencies]
oxblade-icons = "0.1"
oxblade-heroicons = "0.1"
oxblade-lucide = "0.1"Register
icon_set! takes one set crate and returns a registered set with the crate's name, prefix, source and
licence notice. Call .set(...) once per crate:
use oxblade_icons::{Attributes, Icons, icon_set};
fn main() -> oxblade_icons::Result<()> {
let icons = Icons::builder()
.set(icon_set!(oxblade_heroicons))
.set(icon_set!(oxblade_lucide))
.build()?;
println!("{}", icons.svg("heroicon-o-home", "size-6", Attributes::new())?);
println!("{}", icons.svg("lucide-map-pin", "w-4", Attributes::new())?);
Ok(())
}
The macro checks the crate's data format at compile time, so a set crate and an oxblade-icons version that don't match fail to build instead of failing at run time.
In oxblade templates the same names work in all four Blade Icons forms, for example
<x-heroicon-o-home class="size-6" />. See the oxblade-icons
Blade templates page.