Skip to content
Latestv1.0.60

Product Card

High-performance product display component designed for modern e-commerce. Beyond basic layouts, it features a deep-seated marketing badge system, multi-price strategies (VIP/Member), hover multimedia previews, stock feedback, and built-in exposure tracking.

Layout Paradigms

Common layouts for grid, list, and recommendation scenarios.

Grid Layout (Vertical)

List Layout

Horizontal arrangement, suitable for search results or mobile feeds.

List Layout (Horizontal)

Compact Layout

Minimalist display, suitable for sidebars or recommendation snippets.

Compact Layout

Stock Progress

Built-in marketing progress bar to increase conversion rates through visual urgency.

Stock Progress Feedback

Advanced Business Features

Deeply encapsulated features for modern e-commerce business logic.

Marketing Badges & Ribbons

Supports slanted ribbons in the corner and a combination of image/text badges for highlighting promotions.

Marketing Atmosphere

Pricing Logic feedback

Features a comprehensive pricing system including market prices, VIP/final prices, and unit suffixes.

Pricing & ROI

Hover Multimedia Preview

Boost click-through rates by enabling auto-switch to hover-image or silent looping video overlays.

Multimedia Engagement

Conversion Readiness

Handles action button Loading (debounce) and Sold Out (auto-grayscale/mask).

Conversion Status

Analytics Tracking

Built-in IntersectionObserver. When enabled (exposure), the component emits an expose event when it stays in the viewport beyond a threshold.

vue
<yh-product-card exposure :exposure-threshold="0.5" @expose="onExpose" />

Use in Nuxt

YhProductCard supports Nuxt 3/4 SSR rendering. When @yh-ui/nuxt is installed, the component can be auto-imported. For hover video previews, exposure analytics, or other client-only behavior, prefer <ClientOnly> or verify those interactions in client-side lifecycle hooks.

API

Props (100% aligned with source)

PropertyDescriptionTypeDefault
imagePrimary image URLstring''
hover-imageAlt image on mouse hoverstring''
video-srcVideo preview URL on hoverstring''
titleProduct titlestring''
title-linesTitle line clamping limitnumber2
descriptionProduct descriptionstring''
description-linesDescription line clamping limitnumber1
priceCurrent selling pricenumber | string0
market-priceReference/Market pricenumber | string''
vip-priceExclusive member pricenumber | string''
vip-labelMember price tag textstring''
currencyCurrency symbolstring'¥'
unitPrice measurement suffixstring''
ribbonMarketing ribbon textstring''
ribbon-colorRibbon background colorstring''
tagLegacy: Single tag textstring''
tag-typeLegacy: Tag color type'primary' | 'success' | 'warning' | 'danger' | 'info''danger'
badgesMulti-badge array (text/image)ProductBadge[][]
layoutLayout mode'vertical' | 'horizontal' | 'compact' | 'grid''vertical'
lazyImage lazy loadingbooleantrue
borderEnable card borderbooleantrue
shadowEnable hover elevation shadowbooleantrue
readonlyHide all action buttonsbooleanfalse
stock-progressFlash sale stock progress (0-100)number0
stock-colorProgress bar color/gradientstring''
stock-textStock progress labelstring''
action-textPrimary button textstring''
action-loadingPrimary button loading statebooleanfalse
sold-outMark as sold out (mask + grayscale)booleanfalse
exposureEnable automatic exposure analyticsbooleanfalse
exposure-thresholdRatio threshold for analyticsnumber0.5
exposure-onceReport only once per sessionbooleantrue

Events

NameDescriptionParameters
clickFired when clicking the card(e: MouseEvent)
actionFired when clicking primary button(e: MouseEvent)
exposeFired on exposure threshold hit() => void

Slots

NameDescription
titleCustom title template
descriptionCustom description template
footerCustom bottom action area

Expose

This component does not expose public instance methods or properties.

Theme Variables

This component supports theme-overrides for visual customization such as borders, prices, badges, and action areas. When a dedicated CSS variable table is not listed separately, prefer theme-overrides together with global theme tokens as the source of truth.

ProductBadge Interface

ts
interface ProductBadge {
  text?: string
  image?: string
  type?: 'primary' | 'success' | 'warning' | 'danger' | 'info'
  color?: string
}

Type Exports

NameDescription
YhProductCardPropsComponent props type
YhProductCardEmitsComponent emits type
YhProductCardSlotsComponent slots type
YhProductCardLayoutLayout mode union
YhProductBadgeProduct badge type
YhProductCardInstanceComponent instance type

Released under the MIT License.