Display.image

Image

Displays an image with optional sizing, alt text, and a caption.

ctx.ui.display.image({ url, alt, size, caption });

Config


url
string

The URL of the image to display.


alt
string

Alternative text for the image, used for accessibility and in case the image fails to load.


size
"thumbnail" | "small" | "medium" | "large" | "full"

Optional size preset to control the image’s display size. Defaults to natural size if not specified.


caption
string

Optional caption to display below the image.

Usage

Use image elements to visually enhance pages with diagrams, photos, or illustrations.

ctx.ui.page({
  title: "Image example",
  content: [
    ctx.ui.display.image({
      url: "https://example.com/chart.png",
      alt: "Chart showing sales trends",
      size: "medium",
      caption: "Sales trends over the past 6 months",
    }),
  ],
});