Macro freya::prelude::import_image

source ·
macro_rules! import_image {
    ($component_name:ident, $path:expr, { $($key:ident : $value:expr),* $(,)? }) => { ... };
}
Expand description

Generate a Dioxus component rendering the specified image.

§Example


// You can pass as many `image` attributes you need, and these will become the default values and also allowed to be overriden.
import_image!(RustLogo, "../../../examples/rust_logo.png", {
    width: "auto",
    height: "40%",
    aspect_ratio: "min",
});

fn app() -> Element {
    rsx!(RustLogo {
        width: "150",
    })
}