Image

The Image component provides a reusable pattern for image in the interface.

Plain image

Just a plain image

This is a image
Hey, I am a caption for an image

Rounded corners

An image with border radius for rounded corners

This is a image
Image with rounded corners (default size: md)

Missing plain image

Image not found but rendered as a placeholder.

Full width image

Image in full width mode.

This is a image

Cover image

Image with cover mode, that covers the parent container.

This is a image

Container query switching (default)

The default behaviour for an ImageInterface source with several candidate sizes: one <img> per size, switched by CSS container queries. Inspect the element to see multiple <img> tags, only one of which is visible at a time.

A photograph used to demonstrate responsive image loading. A photograph used to demonstrate responsive image loading. A photograph used to demonstrate responsive image loading. A photograph used to demonstrate responsive image loading. A photograph used to demonstrate responsive image loading.
By default, an ImageInterface source with multiple candidate sizes renders one <img> per size, switched by CSS container queries. Inspect the element to see several <img> tags, only one of which is visible.

Single image via srcset (opt-in)

Setting preferSrcset renders a single <img> using srcset, sizes and container query data instead of one <img> per breakpoint. Inspect the element to verify only one <img> is rendered.

A photograph used to demonstrate responsive image loading.
One responsive <img>, fed by a fake ImageInterface with several candidate sizes. Opted in via preferSrcset, since the default is container-query switching.

Focus point

A responsive image with an off-center focus point, verifying that object-position is applied together with the srcset/sizes attributes.

A photograph used to demonstrate responsive image loading.
The image is focused towards the top right corner.

Low quality image placeholder

A responsive image with a low quality placeholder shown as a background while the full image loads.

A photograph used to demonstrate responsive image loading.
A low quality placeholder is shown as a background while the image loads.

Transparent background with LQIP (srcset)

Images with a transparent background don't work well with low quality placeholders: the placeholder is typically encoded without an alpha channel, so it renders with a solid backing colour instead of transparency. Rendered as a single <img> via srcset.

A logo with a transparent background, used to demonstrate low quality image placeholders.
A single <img> via srcset. The low quality placeholder loses its transparency, showing a solid colour behind the final transparent image.

Transparent background with LQIP (container query)

Images with a transparent background don't work well with low quality placeholders: the placeholder is typically encoded without an alpha channel, so it renders with a solid backing colour instead of transparency. Rendered as one <img> per candidate size, switched by CSS container queries.

A logo with a transparent background, used to demonstrate low quality image placeholders. A logo with a transparent background, used to demonstrate low quality image placeholders. A logo with a transparent background, used to demonstrate low quality image placeholders. A logo with a transparent background, used to demonstrate low quality image placeholders. A logo with a transparent background, used to demonstrate low quality image placeholders.
One <img> per candidate size, switched by CSS container queries. The low quality placeholder loses its transparency, showing a solid colour behind the final transparent image.

Single candidate size

An image contract with only one candidate size. No srcset or sizes attribute should be rendered.

A photograph used to demonstrate responsive image loading.
Only one candidate size is available, so no srcset or sizes attribute is rendered.

Eager loading with priority

Overriding imgAttributeList to opt out of the lazy-loading default, useful for above-the-fold images such as a Hero background.

A photograph used to demonstrate responsive image loading.
Overriding imgAttributeList lets a caller opt out of the lazy-loading default, e.g. for above-the-fold images. preferSrcset is also set, since a prioritized image should render once, not switch between several candidates.

API

Parameter Default Type Description
false ComponentLibrary\Integrations\Image\ImageInterface|string|boolean -
false string|boolean -
?string -
string -
false boolean -
string -
false boolean -
false boolean -
false boolean -
true boolean -
false string|boolean -
broken_image string -
xxl string -
[] array -
true boolean -
true boolean -
false boolean -

CSS API

Variable Default Type Values Description
var(--space) range - Base spacing unit. Used for padding and margin inside components.
var(--color--background-alt) color - Manual companion token for subtle background surfaces.
var(--color--background-contrast-muted) color - Derived muted contrast for text and icons on background surfaces.
var(--border-width) range - Border width
var(--color--surface-border) color - Manual companion token for borders on surface elements.
var(--color--surface-contrast) color - Used for text and icons on surface backgrounds with less contrast.
var(--corner-shape) select square, round, squircle, circular, bevel, scoop Corner shape
var(--font-size-90) range - One step below base in the type scale.
var(--font-family-heading) font - Falls back to body font if not set.
var(--font-weight-bold) select 100, 200, 300, 400, 500, 600, 700, 800, 900 Placeholder font weight
var(--line-height-base) range - Caption line height
1 range - Scales the border radius locally without changing the global border radius scale.