Skip to main content

Display packs and pulls

Give the image a consistent frame, but preserve the artwork's proportions. A slab, booster pack and pack have different shapes; forcing them to fill the frame crops or stretches them.

Use the URL returned by the API. For an opening result, artwork is on rewards[i].product, not the outer reward. Product records may use image_url, image, or the first entry in images. Select the first non-empty image URL; if none exists, show a neutral placeholder rather than a broken image or another product's artwork.

const product = reward.product ?? {};
const imageUrl = [product.image_url, product.image, product.images?.[0]]
.find(value => typeof value === "string" && /^https?:\/\//.test(value));

Put your image inside a frame with this CSS. Apply .collectible-art to the frame and use the product name for the image's alt text.

.collectible-art {
width: 100%;
aspect-ratio: 4 / 5;
display: grid;
place-items: center;
background: #f5f5f6;
border-radius: 16px;
}

.collectible-art img {
display: block;
width: 100%;
height: 100%;
min-width: 0;
min-height: 0;
box-sizing: border-box;
padding: 6%;
object-fit: contain;
object-position: center;
}

contain fits the whole image. Avoid cover, fill, or a fixed stretched background. Keep a small amount of padding so slab labels and pack edges remain visible. If a specific asset has built-in transparent space, adjust that asset's display carefully; don't apply the same zoom to every pack, slab and pack.

With Next.js <Image fill>, give the frame position: relative, set responsive sizes, and keep object-fit: contain. Configure allowed image hosts for your app if you use Next's image optimizer.

Use the same frame in pack details, top pulls, the reveal and the vault. Animate the frame for a reveal, not the image's width and height independently. Check tall packs and wide packs on both mobile and desktop. Visual effects must not choose or change the server-returned pull.

Commerce reference ยท Read API pack data