Image

One image with an optional caption.

When to use it

One image in the text, with an optional caption: a photo, a chart, a screenshot.

When not to

Several images together (use gallery) and images that lead to another page (use teaser or cards).

Accessibility

Describe what the image shows for someone who cannot see it; the caption is shown to everyone. SeedPage makes the sizes and formats each screen needs and loads the image when it comes into view.

See it live

The component library shows this component in the default theme, in every variant: open it in the component library

The image example as the component library shows it in the default theme

Where it is used

The starter sites that use it, each at a page that shows it:

Fields

What the component’s dialog asks for. In a Doc, keyed rows start with the key; rows in order follow the order below. One row, its cells in the order of the fields.

Field

Key

Kind

Required

Image

image

An image from the assets, with its description

Yes

Caption

caption

Plain text, one line

No

Variants

This component has no variants of its own; a theme can add some.

In Google Docs

A component is a table. Its first cell names it; the rows below hold its fields. This is the example table:

image

[Image]

Morning on the lake

In a page file

In a site kept as a folder or in Git, the same component is a block of the page’s JSON file:

JSON
{
  "name": "image",
  "rows": [
    [
      {
        "image": "Kayaks on a lake"
      },
      "Morning on the lake"
    ]
  ]
}

Markup and classes

What the component writes takes these classes, for a theme’s CSS: the component’s own name, name__part for its parts and name--variant for each variant (the variant’s plain name is there too).

Class

What it marks

image

The component

The HTML the example above writes, as the component library builds it in the default theme:

html
<figure class="image"><img src="/assets/img/5521e01d770e-1600.webp" srcset="/assets/img/5521e01d770e-400.webp 400w, /assets/img/5521e01d770e-800.webp 800w, /assets/img/5521e01d770e-1600.webp 1600w" sizes="(max-width: 800px) 100vw, 800px" alt="Kayaks on a lake" width="1800" height="900" fetchpriority="high" decoding="async"><figcaption><p>Morning on the lake</p></figcaption></figure>

Extending it

Its files in SeedPage. A theme or a site changes the markup by giving a file of the same name (the Liquid part), and a new component can extend this one.

  • src/components/image.js
  • src/components/image/image.liquid