Product Card

PreviousNext

A flexible compound component for displaying product information with images, badges, and metadata.

Twemco Clock

Twemco Clock

Clock

12

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/product-card.json

Usage

import {
  ProductCard,
  ProductCardImage,
  ProductCardBadge,
  ProductCardContent,
  ProductCardHeader,
  ProductCardTitle,
  ProductCardSubtitle,
  ProductCardMetric,
} from "@/registry/delta-ui/delta/product-card"
 
export default function Example() {
  const [isWishlisted, setIsWishlisted] = React.useState(false)
 
  return (
    <ProductCard>
      <ProductCardImage src="/product.jpg" alt="Product">
        <ProductCardBadge
          isActive={isWishlisted}
          onClick={() => setIsWishlisted(!isWishlisted)}
        >
          Wishlist
        </ProductCardBadge>
      </ProductCardImage>
 
      <ProductCardContent>
        <ProductCardHeader>
          <ProductCardTitle>Product Name</ProductCardTitle>
          <ProductCardSubtitle>Category</ProductCardSubtitle>
        </ProductCardHeader>
        <ProductCardMetric>$99</ProductCardMetric>
      </ProductCardContent>
    </ProductCard>
  )
}

Examples

Inner Variant

Display content inside the image area with the variant="inner" prop.

Twemco Clock

Twemco Clock

Clock

12

Custom Content

Customize the card with badges, icons, and additional content.

Sizes

The component supports three sizes: sm, default, and lg.

Analogue Pocket

Analogue Pocket

Gaming Console

$219

API Reference

ProductCard

The root container component.

PropTypeDefaultDescription
variant"default" | "inner""default"Card layout variant - "default" shows content below image, "inner" overlays content on image
size"sm" | "small" | "default" | "lg" | "large""default"Card size affecting padding and text sizes
onCardClick() => void-Callback when the card is clicked
classNamestring-Additional CSS classes

ProductCardImage

Image container with Next.js Image optimization.

PropTypeDefaultDescription
srcstring-Image source URL (required)
altstring-Image alt text for accessibility (required)
prioritybooleanfalsePriority loading for LCP optimization
unoptimizedbooleanfalseSkip Next.js image optimization (allows external URLs without config)
imageClassNamestring-Additional CSS classes for the image element
classNamestring-Additional CSS classes for the container

ProductCardBadge

Interactive badge overlay for the image.

PropTypeDefaultDescription
isActivebooleanfalseWhether the badge is in active/selected state
iconReact.ReactNode-Icon to display before label
onClick(e: React.MouseEvent) => void-Click handler (stops propagation automatically)
classNamestring-Additional CSS classes

ProductCardContent

Container for the card's text content.

PropTypeDefaultDescription
classNamestring-Additional CSS classes

ProductCardHeader

Wrapper for title and subtitle.

PropTypeDefaultDescription
classNamestring-Additional CSS classes

ProductCardTitle

Product title heading.

PropTypeDefaultDescription
classNamestring-Additional CSS classes

ProductCardSubtitle

Product subtitle or category.

PropTypeDefaultDescription
classNamestring-Additional CSS classes

ProductCardMetric

Metric display (price, rating, etc).

PropTypeDefaultDescription
classNamestring-Additional CSS classes

Features

  • Compound Component Pattern: Compose cards with flexible sub-components
  • Two Variants: Default (content below) and Inner (content overlay)
  • Three Sizes: Small, default, and large with responsive scaling
  • Interactive Badge: Built-in wishlist/favorite badge with state
  • Image Optimization: Next.js Image component with automatic optimization
  • Accessibility: Proper ARIA labels and semantic HTML
  • Hover Effects: Smooth image lift animation on hover
  • TypeScript: Full type safety with exported prop types