Products · Components

Image

A picture from your dot or from the web.

Set aspect to keep the space while the picture loads, and give it an alt for screen readers.

Children: Nothing

Example

The Image component
view.dml
<Image src="statics/photo.jpg" alt="A photo" aspect="16:9" fit="cover" shape="rounded" />

Props

PropTypeWhat it is
srcstringA picture in the dot's statics/ folder, such as "statics/photo.jpg", an https address on a host in network.hosts in dot.json, or a DotFile's url.
altstring
widthnumber
heightnumber
fitcover, containcover fills the box and crops. contain shows the whole picture. Default: cover.
shaperounded, square, circleDefault: rounded.
aspectaspect ratioThe box's shape. Without a width, the picture fills the width it's given, such as the screen's, and its height follows.

Events

EventSendsNotes
onLoad{ width, height } in detailThe image's size in pixels.
onError{ message } in detail

Keep reading

On this page