Struct ImageProps

Source
pub struct ImageProps {
Show 26 fields pub src: &'static str, pub alt: &'static str, pub fallback_src: &'static str, pub width: &'static str, pub height: &'static str, pub style: &'static str, pub class: &'static str, pub sizes: &'static str, pub loading: Loading, pub placeholder: &'static str, pub on_load: Option<Callback<()>>, pub object_fit: ObjectFit, pub object_position: Position, pub on_error: Option<Callback<String>>, pub decoding: Decoding, pub blur_data_url: &'static str, pub layout: Layout, pub node_ref: NodeRef<Img>, pub srcset: &'static str, pub crossorigin: CrossOrigin, pub referrerpolicy: ReferrerPolicy, pub usemap: &'static str, pub ismap: bool, pub fetchpriority: FetchPriority, pub elementtiming: &'static str, pub attributionsrc: &'static str,
}
Available on crate feature lep only.
Expand description

Props for the Image component.

ยง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).

Fieldsยง

ยง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: Option<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: Option<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).

Implementationsยง

Sourceยง

impl ImageProps

Source

pub fn builder() -> ImagePropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>

Create a builder for building ImageProps. On the builder, call .src(...)(optional), .alt(...)(optional), .fallback_src(...)(optional), .width(...)(optional), .height(...)(optional), .style(...)(optional), .class(...)(optional), .sizes(...)(optional), .loading(...)(optional), .placeholder(...)(optional), .on_load(...)(optional), .object_fit(...)(optional), .object_position(...)(optional), .on_error(...)(optional), .decoding(...)(optional), .blur_data_url(...)(optional), .layout(...)(optional), .node_ref(...)(optional), .srcset(...)(optional), .crossorigin(...)(optional), .referrerpolicy(...)(optional), .usemap(...)(optional), .ismap(...)(optional), .fetchpriority(...)(optional), .elementtiming(...)(optional), .attributionsrc(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of ImageProps.

Trait Implementationsยง

Sourceยง

impl Props for ImageProps

Sourceยง

type Builder = ImagePropsBuilder

Sourceยง

fn builder() -> Self::Builder

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<T> InitializeFromFunction<T> for T

Sourceยง

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

impl<T> IntoPropValue<Option<T>> for T

Sourceยง

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
Sourceยง

impl<T> IntoPropValue<T> for T

Sourceยง

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
Sourceยง

impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Sourceยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Sourceยง

impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Sourceยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Sourceยง

impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Sourceยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<T> SerializableKey for T

Sourceยง

fn ser_key(&self) -> String

Serializes the key to a unique string. Read more
Sourceยง

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Sourceยง

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Sourceยง

impl<T> StorageAccess<T> for T

Sourceยง

fn as_borrowed(&self) -> &T

Borrows the value.
Sourceยง

fn into_taken(self) -> T

Takes the value.
Sourceยง

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Sourceยง

fn super_from(input: T) -> O

Convert from a type to another type.
Sourceยง

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Sourceยง

fn super_into(self) -> O

Convert from a type to another type.
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

impl<Token, Builder, How> AllPropsFor<Builder, How> for Token
where Builder: Buildable<Token>, <Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,

Sourceยง

impl<T> ErasedDestructor for T
where T: 'static,

Sourceยง

impl<T> HasAllProps<(), T> for T