use dioxus::prelude::*;
#[component]
pub fn Icon(
icon: TablerIcon,
#[props(default = 24)]
size: u32,
#[props(default = "currentColor".to_string())]
color: String,
#[props(default = 2.0)]
stroke_width: f32,
#[props(default)]
class: String,
#[props(default = false)]
fill: bool,
) -> Element {
let fill_val = if fill { &color } else { "none" };
let stroke_val = if fill { "none" } else { &color };
let icon_name = icon.name();
rsx! {
svg {
xmlns: "http://www.w3.org/2000/svg",
width: "{size}",
height: "{size}",
view_box: "0 0 24 24",
fill: "{fill_val}",
stroke: "{stroke_val}",
stroke_width: "{stroke_width}",
stroke_linecap: "round",
stroke_linejoin: "round",
class: "tabler tabler-{icon_name} {class}",
dangerous_inner_html: icon.svg_content(),
}
}
}
include!(concat!(env!("OUT_DIR"), "/tabler_icons.rs"));