Skip to content

Product Item Card

Use ProductItemCard to display a product recommendation with an image, title, price, SKU, swatches, and an action button. Each region is a node you pass in, so you control what renders in every slot. Until you set initialized to true, the card renders a loading skeleton.

The SDK ProductItemCard showing a product with image, title, price, and an action button.
import { ProductItemCard } from '/@dropins/tools/components.js';
PropTypeReq?Description
imageVNodeNoProduct image node.
titleNodeVNodeNoProduct title node.
priceVNodeNoProduct price node.
skuVNodeNoProduct SKU node.
swatchesVNodeNoProduct swatches node.
actionButtonVNodeNoAction button node.
initializedbooleanNoRender the card content when true; otherwise render a loading skeleton. Defaults to false.

ProductItemCard also accepts standard HTML attributes (for example, onClick, className), except loading.

Build each region with h, then pass the nodes as props. Image, Price, and Button are exported from the same package.

import { ProductItemCard, Image, Price, Button, provider } from '/@dropins/tools/components.js';
import { h } from '/@dropins/tools/preact.js';
await provider.render(ProductItemCard, {
initialized: true,
image: h(Image, { src: '/media/sweatshirt.jpg', alt: 'Backyard Sweatshirt', width: '300', height: '375' }),
titleNode: h('div', {}, 'Hollister Backyard Sweatshirt'),
sku: h('div', {}, 'SKU: 123456789'),
price: h(Price, { amount: 49.99 }),
actionButton: h(Button, { children: 'Add to Cart' }),
})(document.querySelector('.product-item-card'));
  • Button — commonly passed as the actionButton node.
  • Skeleton — the placeholder shown before the card is initialized.