Image
Allows users to display images.
app.image
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="https://imgs.search.brave.com/0zw6axirD-RvnDuNzaN6W1p-rkH1o10AkBP5PTxb1fc/rs:fit:860:0:0:0/g:ce/aHR0cHM6Ly9tZWRp/YS5pc3RvY2twaG90/by5jb20vaWQvNDc2/NTUwMzQ5L3Bob3Rv/L2RvbHBoaW5zLWp1/bXBpbmcuanBnP3M9/NjEyeDYxMiZ3PTAm/az0yMCZjPWNsMWZs/ZG5CWHlXRndBRWQ3/dkNXRFR4b1dVZXZi/bUJzeEVySTVQc2hF/M1U9",
alt="Dolphin",
preview=True,
height=300,
width=300,
placeholder=True
)