--- title: Thumbnail description: 'Display a small preview image representing content, products, or media.' api_name: app-home source_url: html: 'https://shopify.dev/docs/api/app-home/polaris-web-components/media/thumbnail' md: >- https://shopify.dev/docs/api/app-home/polaris-web-components/media/thumbnail.md --- # Thumbnail Display a small preview image representing content, products, or media. ## Properties * alt string Default: \`''\` An alternative text description that describe the image for the reader to understand what it is about. It is extremely useful for both users using assistive technology and sighted users. A well written description provides people with visual impairments the ability to participate in consuming non-text content. When a screen readers encounters an `s-image`, the description is read and announced aloud. If an image fails to load, potentially due to a poor connection, the `alt` is displayed on screen instead. This has the benefit of letting a sighted buyer know an image was meant to load here, but as an alternative, they’re still able to consume the text content. Read [considerations when writing alternative text](https://www.shopify.com/ca/blog/image-alt-text#4) to learn more. * size "small" | "small-200" | "small-100" | "base" | "large" | "large-100" Default: 'base' Adjusts the size the product thumbnail image. * src string The image source (either a remote URL or a local file resource). When the image is loading or no `src` is provided, a placeholder will be rendered. ## Events Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling). * error OnErrorEventHandler * load CallbackEventListener\ | null ### CallbackEventListener ```ts (EventListener & { (event: CallbackEvent): void; }) | null ``` ### CallbackEvent ```ts Event & { currentTarget: HTMLElementTagNameMap[T]; } ``` ### Examples * #### Code ##### jsx ```jsx ``` ##### html ```html ``` ## Examples Component examples ### Basic usage Basic usage Demonstrates a basic thumbnail component with a product image, showing the default base size and an alt text for accessibility. Empty state Shows the thumbnail component in an empty state, displaying a placeholder icon when no image source is provided. Different sizes Illustrates the various size options for the thumbnail component, showcasing small-200, base, and large sizes in a stack layout. With event handling Demonstrates how event handlers like onload or onerror can be attached to the thumbnail component via JavaScript to handle image loading states. ### Examples * #### Basic usage ##### Description Demonstrates a basic thumbnail component with a product image, showing the default base size and an alt text for accessibility. ##### jsx ```jsx ``` ##### html ```html ``` * #### Empty state ##### Description Shows the thumbnail component in an empty state, displaying a placeholder icon when no image source is provided. ##### jsx ```jsx ``` ##### html ```html ``` * #### Different sizes ##### Description Illustrates the various size options for the thumbnail component, showcasing small-200, base, and large sizes in a stack layout. ##### jsx ```jsx ``` ##### html ```html ``` * #### With event handling ##### Description Demonstrates how event handlers like onload or onerror can be attached to the thumbnail component via JavaScript to handle image loading states. ##### jsx ```jsx const [loading, setLoading] = useState(true) return ( setLoading(false)} /> {loading ? 'Loading...' : 'Image loaded'} ) ``` ##### html ```html Image loaded ```