Function Image

Source
pub fn Image(props: ImageProps) -> impl IntoView
Available on crate feature lep only.
Expand description

§Optional Props

  • src: [&'static str]
    • The source URL of the image.

      This is the primary image that will be rendered.

  • alt: [&'static str]
    • The alternative text for the image.

      Used for accessibility and shown if the image cannot be displayed.

  • fallback_src: [&'static str]
    • A fallback image URL if the main image fails to load.
  • width: [&'static str]
    • Width of the image (e.g., “100px”, “auto”).
  • height: [&'static str]
    • Height of the image (e.g., “100px”, “auto”).
  • style: [&'static str]
    • Inline styles applied to the image.
  • class: [&'static str]
    • CSS class name(s) to apply to the image.
  • sizes: [&'static str]
    • Image sizes attribute for responsive loading.
  • loading: Loading
    • Defines how the image is loaded. Defaults to lazy loading.
  • placeholder: [&'static str]
    • Placeholder content shown while the image loads.
  • on_load: [Callback<()>]
    • Callback function fired when the image is successfully loaded.
  • object_fit: ObjectFit
    • Specifies how the image should be resized to fit its container.
  • object_position: Position
    • Specifies the position of the image within its container.
  • on_error: Callback<String>
    • Callback function fired when the image fails to load.
  • decoding: Decoding
    • Specifies how the image should be decoded (auto, sync, async).
  • blur_data_url: [&'static str]
    • Base64-encoded blurred image shown before the main image loads.
  • layout: Layout
    • Controls how the image is laid out inside its container.
  • node_ref: NodeRef<Img>
    • Reference to the image DOM element.
  • srcset: [&'static str]
    • One or more image sources with descriptors (e.g., “img-1x.jpg 1x, img-2x.jpg 2x”).
  • crossorigin: CrossOrigin
    • CORS policy for fetching the image (none, anonymous, use-credentials).
  • referrerpolicy: ReferrerPolicy
    • Referrer policy when fetching the image.
  • usemap: [&'static str]
    • Associates the image with an image map.
  • ismap: bool
    • Indicates the image is part of a server-side image map.
  • fetchpriority: FetchPriority
    • Fetch priority hint for the browser (auto, high, low).
  • elementtiming: [&'static str]
    • Identifier for performance element timing.
  • attributionsrc: [&'static str]
    • Indicates the current item in a set for accessibility. ID reference to the element describing this image. Whether the associated content is expanded or collapsed. Whether the image is hidden from assistive technologies. #[prop(optional)] aria_hidden: &’static str, Indicates the pressed state of the image if it’s used as a toggle. ID reference to the element this image controls. ID reference to the element that labels this image. Indicates whether updates to the image are live. URLs for Attribution Reporting (experimental feature).