Image
Allows users to display images.
Function signature
app.image(alt='', preview=True, height=None, placeholder=True, src=None, width=None)
Parameters
Parameter | Description |
---|---|
alt (str) | The description of the image, used for accessibility. |
preview (bool) | Enables or disables the image preview feature. |
height (Union[str, int]) | The height of the image, specified as a string or integer. |
placeholder (Union[bool, VisualComponent]) | Placeholder displayed while the image is loading, can be a boolean or a custom component. |
src (ImageLike) | The source of the image, compatible with various image formats. |
width (Union[str, int]) | The width of the image, specified as a string or integer. |
Example
The example below shows how to create an image component.
from shapelets.apps import dataApp
# Set up Data App
app = dataApp()
# Set the title of the app
app.title("Image Widget - Dolphins Jumping")
# Add a new image source
img_component = app.image(
src = "dolphin.png",
alt="Dolphin",
preview=True,
height=300,
width=300,
placeholder=True
)