Constant freya_elements::elements::image::cover

source ยท
pub const cover: (&'static str, Option<&'static str>, bool);
Expand description

cover controls how an image element position is rendered inside the given dimensions.

Accepted values:

  • fill (default): The image will be rendered from the start of the given dimensions.
  • center: The image will be rendered in the center of the given dimensions.
static RUST_LOGO: &[u8] = include_bytes!("../_docs/rust_logo.png");

fn app() -> Element {
    let image_data = static_bytes(RUST_LOGO);
    rsx!(
        image {
            image_data,
            width: "100%",
            height: "100%",
            cover: "center"
        }
    )
}