Expand description
image element let’s you show an image.
For dynamic Images you may use dynamic_bytes.
§Example
ⓘ
static RUST_LOGO: &[u8] = include_bytes!("./rust_logo.png");
fn app() -> Element {
let image_data = static_bytes(RUST_LOGO);
rsx!(
image {
image_data,
width: "100%", // You must specify size otherwhise it will default to 0
height: "100%",
}
)
}Constants§
- a11y_
access_ key - a11y_
author_ id - a11y_
auto_ complete - a11y_
auto_ focus - a11y_
busy - a11y_
color_ value - a11y_
column_ count - a11y_
column_ index - a11y_
column_ index_ text - a11y_
column_ span - a11y_
current - a11y_
default_ action_ verb - a11y_
description - a11y_
disabled - a11y_
expanded - a11y_
focusable - a11y_
has_ popup - a11y_
hidden - a11y_
hovered - a11y_id
- a11y_
invalid - a11y_
is_ grammar_ error - a11y_
is_ search_ match - a11y_
is_ spelling_ error - a11y_
is_ suggestion - a11y_
keyboard_ shortcut - a11y_
language - a11y_
level - a11y_
linked - a11y_
list_ style - a11y_
live - a11y_
live_ atomic - a11y_
max_ numeric_ value - a11y_
min_ numeric_ value - a11y_
modal - a11y_
multiselectable - a11y_
name - a11y_
numeric_ value - a11y_
numeric_ value_ jump - a11y_
numeric_ value_ step - a11y_
orientation - a11y_
placeholder - a11y_
position_ in_ set - a11y_
read_ only - a11y_
required - a11y_
role - a11y_
role_ description - a11y_
row_ count - a11y_
row_ index - a11y_
row_ index_ text - a11y_
row_ span - a11y_
scroll_ x - a11y_
scroll_ x_ max - a11y_
scroll_ x_ min - a11y_
scroll_ y - a11y_
scroll_ y_ max - a11y_
scroll_ y_ min - a11y_
selected - a11y_
size_ of_ set - a11y_
sort_ direction - a11y_
state_ description - a11y_
toggled - a11y_
tooltip - a11y_
touch_ transparent - a11y_
url - a11y_
value - a11y_
vertical_ offset - a11y_
visited - aspect_
ratio aspect_ratiocontrols how animageelement is rendered when facing unexpected dimensions.- cache_
key cache_keylets you specify an unique identifier for the given image. This will help Freya cache the image decoding, if the cache_key changes the old cache will be pruned and the image (changed or not) will be decoded again.cache_keyis optinal but its recommended to be used, specialy for high quality images. You can pass any value that can be transformed into a string. Like a URL.- content
- Specify how you want the automatic (e.g
width: auto) bounds in the cross axis to be constrained for the inner elements. - cover
covercontrols how animageelement position is rendered inside the given dimensions.- cross_
align - cross_align
- direction
- Control how the inner elements stack.
- height
- Specify the height for the given element.
- image_
data - Specify the image data for the image element.
- image_
reference - Specify an image reference handle for the image element.
- layer
- Controls the stacking order of elements on the z-axis.
- main_
align - main_align
- margin
- Specify the margin of an element. You can do so by four different ways, just like in CSS.
- max_
height - Specify a maximum height for the given element.
- max_
width - Specify a maximum width for the given element.
- min_
height - Specify a minimum height for the given element. This can be useful if you use it alongside a percentage for the target size.
- min_
width - Specify a minimum width for the given element. This can be useful if you use it alongside a percentage for the target size.
- offset_
x - Moves the content inside of the container horizontally by the specified pixel amount. This attribute only supports pixels.
- offset_
y - Moves the content inside of the container vertically by the specified pixel amount. This attribute only supports pixels.
- opacity
- Specify the opacity for this element.
- overflow
- Specify how overflow should be handled.
- position
- Specify how you want the element to be positioned inside it’s parent area.
- position_
bottom - Specify the bottom position of an element when using
position: "absolute"orposition: "global". This supports pixels only. - position_
left - Specify the left position of an element when using
position: "absolute"orposition: "global". This supports pixels only. - position_
right - Specify the right position of an element when using
position: "absolute"orposition: "global". This supports pixels only. - position_
top - Specify the top position of an element when using
position: "absolute"orposition: "global". This supports pixels only. - reference
- Attach a reference to an element to track its layout and metadata.
- rotate
- Specify the rotation for this element.
- sampling
samplingcontrols how animageelement is resized when scaling from its original size to smaller or larger sizes.- spacing
- Specify a space between the inner elements. Think it as a margin for every element but defined by its parent. It only applies to the side of the direction.
- width
- Specify the width for the given element.