Image
Overview¶
Image is the equivalent of an <img>
HTML element.
Examples¶
import mesop as me
def load(e: me.LoadEvent):
me.set_theme_mode("system")
@me.page(
on_load=load,
security_policy=me.SecurityPolicy(
allowed_iframe_parents=["https://google.github.io"]
),
path="/image",
)
def app():
with me.box(style=me.Style(margin=me.Margin.all(15))):
me.image(
src="https://interactive-examples.mdn.mozilla.net/media/cc0-images/grapefruit-slice-332-332.jpg",
alt="Grapefruit",
style=me.Style(width="100%"),
)
API¶
image
¶
This function creates an image component.
PARAMETER | DESCRIPTION |
---|---|
src |
The source URL of the image.
TYPE:
|
alt |
The alternative text for the image if it cannot be displayed.
TYPE:
|
style |
The style to apply to the image, such as width and height.
TYPE:
|
key |
The component key.
TYPE:
|