Macro freya::components::import_image

source ยท
macro_rules! import_image {
    ($component_name:ident, $path:expr, $width: expr, $height: expr) => { ... };
    ($component_name:ident, $path:expr) => { ... };
}
Expand description

Generate a Dioxus component rendering the specified image.

Example:


import_svg!(Ferris, "../../../examples/rust_logo.png", "100%", "100%");
import_svg!(FerrisWithRequiredSize, "../../../examples/rust_logo.png");

fn app() -> Element {
    rsx!(Ferris {})
}

fn another_app() -> Element {
    rsx!(FerrisWithRequiredSize {
        width: "150",
        height: "40%",
    })
}