Image

A picture that reserves its space before it loads and draws a muted box when there is none.

Example

The Heulen share card
The picture link previews show.
tsx
<Figure>
  <Image
    src="/share.png"
    alt="The Heulen share card"
    aspectRatio="1200 / 630"
    rounded
  />
  <FigureCaption>The picture link previews show.</FigureCaption>
</Figure>

Usage

Pages are built on the server: import the tags from @dash/server and return the tree. The browser runtime draws it.
tsx
import { Image, Figure, FigureCaption } from "@dash/server";

Props

ImageProps

Prop
Type
Description
srcstring
alt (required)string
aspectRatiostring | numberReserves the space before the picture loads, e.g. `"1 / 1"`, `"4 / 3"` or `1.5`.
fit"cover" | "contain"How the picture fills its box (default `cover`).
widthnumber | stringA number is pixels; a string is any CSS length. Default: the full width available.
heightnumber | string
loading"lazy" | "eager"`lazy` (default) defers loading until the image nears the viewport.
roundedboolean | "full"Corners follow the theme: `true` is `--radius`, `"full"` is `--radius-full`.
On this page