Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Image

Use Image to display visual content like product photos and illustrations. When you pass params, it generates a responsive srcset from the source URL, and it adds a loaded class once the image finishes loading.

The SDK Image showing product visual content.
import { Image } from '@dropins/tools/components.js';
PropTypeReq?Description
srcstringYesImage URL.
paramsResolveImageUrlOptionsNoParameters appended to the image URL to generate a responsive srcset.
sizesstringNoThe sizes attribute for responsive images.
onLoad(e: any) => voidNoCallback fired when the image finishes loading.

Image also accepts standard image HTML attributes (for example, alt, width, height, and loading, which defaults to lazy).

Render a product’s gallery image with explicit dimensions and a responsive srcset:

import { Image, provider } from '@dropins/tools/components.js';
await provider.render(Image, {
src: yourProduct.images[0].url,
alt: yourProduct.images[0].label,
width: 400,
height: 400,
// Generates a responsive srcset from the source URL.
params: { width: 400, height: 400 },
})(yourElement);
  • Image Swatch — a selectable, image-based option built on Image.
  • Content Grid — lay out images in a responsive grid.