Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.

Product thumbnail

The ProductThumbnail component is a representation of a product image. It provides a visual preview of the item, so buyers can quickly identify products.

Support
Targets (50)

Supported targets


Anchor to ProductThumbnailPropsProductThumbnailProps

Anchor to accessibilityLabel
accessibilityLabel
string
Default: `''`

The alternative text that describes the product thumbnail for assistive technologies. Screen readers announce this text when they encounter the image, and it displays as a fallback if the image fails to load.

An alt property is available as an alias for compatibility with the HTML specification. When both are specified, accessibilityLabel takes precedence.

Learn more about writing effective alternative text and the alt attribute.

string

The alternative text that describes the product thumbnail for assistive technologies. Screen readers announce this text when they encounter the image, and it displays as a fallback if the image fails to load.

This property is an alias for accessibilityLabel for compatibility with the HTML specification. When both are specified, accessibilityLabel takes precedence.

Learn more about writing effective alternative text and the alt attribute.

Anchor to badge
badge
number

A number displayed as a badge on the product thumbnail, typically used to indicate the quantity of the product in a cart or order.

'small' | 'base'
Default: 'base'

The size of the product thumbnail image.

  • base: Renders the thumbnail at its standard size.
  • small: A compact thumbnail for tighter layouts.
Anchor to source
source
<string, >

The image source (either a remote URL or a local file resource).

A src property is available as an alias for this for compatibility with the HTML specification. When both are specified, source takes precedence.

Learn more about the src attribute.

<string, >

The image source (either a remote URL or a local file resource).

This property is available as an alias for source for compatibility with the HTML specification. When both are specified, source takes precedence.

Learn more about the src attribute.


Anchor to Basic ProductThumbnailBasic ProductThumbnail

Basic ProductThumbnail

Example

Basic ProductThumbnail

import {
reactExtension,
ProductThumbnail,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
<ProductThumbnail
source="/assets/api/checkout-extensions/checkout/components/product-thumbnail-example-code.png"
badge={2}
/>
);
}
import {extension, ProductThumbnail} from '@shopify/ui-extensions/checkout';

export default extension('purchase.checkout.block.render', (root) => {
const paymentIcon = root.createComponent(ProductThumbnail, {
source:
'/assets/api/checkout-extensions/checkout/components/product-thumbnail-example-code.png',
badge: 2,
});

root.appendChild(paymentIcon);
});

  • Provide descriptive alt text: Write descriptive alt attributes that describe the product, including variant details like size and color. Avoid generic labels like “shirt” or “book”. See Shopify's alt text guidance to learn more about alt text best practices.
  • Size thumbnails for your context: Smaller thumbnails work better in dense layouts like lists, while larger sizes suit product-focused interfaces like a recommended product block. Consider the buyer's task and the information density when selecting a size.
  • Use quantity badges appropriately: Set badge only when the ProductThumbnail component represents a bundle or multi-quantity line item.
  • Maintain visual consistency: Keep a consistent visual style and aspect ratio across ProductThumbnail components in your extension. This consistency helps buyers recognize and associate thumbnails with product offerings.
  • Optimize for visual clarity and loading time: Choose a resolution and image quality that provide visual clarity while maintaining fast load times. For fast, reliable delivery during checkout, consider hosting images from Shopify's CDN.

  • The ProductThumbnail component renders at a fixed aspect ratio and crops non-square images to fit using center cropping.
  • The ProductThumbnail component doesn't support custom pixel dimensions or percentage dimensions.
  • Custom placeholder graphics aren't available when images fail to load or no source is provided.

Was this page helpful?