image
Image
from dara.components.common.image import Image
class Image(ContentComponent)
An Image Component for adding image files to your document.
Accepts a single parameter src
that should be a URL pointing to a local or remote image.
Local URLs should be provided in the format of /static/path_to_image.extension
An Image component can be rendered like:
from dara.core import ConfigurationBuilder()
from dara.components.common import Image
config = ConfigurationBuilder()
# Local image located in ./static/image.test.png
Image(
src='/static/image.test.png'
)
# Local image located in a different static folder - ./custom_statics/image.gif
# `add_static_folder` merges statics from the specified folder with `./static`
config.add_static_folder('./custom_statics')
Image(src='/static/image.gif')
# Remote image
Image(src='https://example.com/some_image.png')
Arguments:
src
: The URL to the local or remote image
Attributes
- src: str