Product Card (vviinn-product-card)
Card for one search result or recommendation. Renders a product, a content entry or a list entry, depending on entity-type.
Generated from vviinn-widgets 2.228.0, the latest release when these docs were built. If you pin an older version, some of these may not be in it yet — check the Changelog.
Try the properties live in the Playground.
Properties
Section titled “Properties”Set them as HTML attributes.
add-price-containerWrap the Product Card's price values in the container.
Type:
boolean· Default:falseadd-to-basket-showShow or hide the Add to Basket button
Type:
booleanbase-pricePrice per unit, as an object or a JSON string:
{"price": 9.99, "quantity": 100, "measure": "ml"}Type:
string | { price?: number; quantity?: number; measure?: string; }base-sale-pricePrice per unit for the sale price, in the same shape as
base-priceType:
string | { price?: number; quantity?: number; measure?: string; }brandProduct brand. Also set as
data-brandon the card, so CSS can target cards by brandType:
stringcss-urlURL to external CSS file for custom styling
Type:
string· Default:nullcurrency-signThe currency sign is displayed after the price
Type:
string· Default:undefinedcustom-labelsLabels from the product feed, separated by
|. Hidden by default — show them with thecustom-label-Nparts, which exist for the first five. Also set asdata-custom-label-NType:
string· Default:""deeplinkProduct page URL for the title and image links. Standalone, the card doesn't navigate — handle
vviinnProductClickType:
stringenergy-certificationsEnergy labels, set as a JS property
Type:
{ certificationClass?: "A+++" | "A++" | "A+" | "A" | "B" | "C" | "D" | "E" | "F" | "G"; classIconUrls?: { left: string; right: string; }; classRange?: { min?: "A+++" | "A++" | "A+" | "A" | "B" | "C" | "D" | "E" | "F" | "G"; max?: "A+++" | "A++" | "A+" | "A" | "B" | "C" | "D" | "E" | "F" | "G"; }; classLabelUrl?: string; classDataSheetUrl?: string; productType?: string; }[]entity-typeWhat the card shows: a
product, acontententry or alistentryType:
"content" | "list" | "product"· Default:"product"favorite-showShow or hide Favorite button
Type:
booleanimageURL of the main product image
Type:
stringimage-widthImage width in pixels. Ignored when
responsiveis setType:
number· Default:PRODUCT_CARD_IMAGE_WIDTHimagesProduct images, set as a JS property. Used by
show-multiple-imageswhen there are at least twoType:
{ original: string; thumbnail: string; }[]· Default:[]is-set-modeRender the card for Set mode: Update button, discount label, and Add to Basket regardless of
add-to-basket-showType:
boolean· Default:falselocaleLocale for text localization
Type:
"de-DE" | "en-US"number-localeLocale for number formatting. Falls back to locale
Type:
stringpriceRegular price
Type:
numberprice-prefixPrefix is displayed before the price
Type:
stringproduct-titleProduct title
Type:
stringproduct-typeProduct type
Type:
stringresponsiveLet the image fill the card width instead of
image-widthType:
boolean· Default:falsesale-priceSale price. When set, the regular price is shown as outdated next to it
Type:
numbershow-multiple-imagesShow multiple images: swiper on mobile, hover on desktop
Type:
boolean· Default:falseLocation of Update button for Set mode
Type:
"onItem" | "onTop" | "topAndItem"
Events
Section titled “Events”Listen with document.addEventListener(). The pages under Events describe the data each event carries.
| Event | Description |
|---|---|
vviinnAddToBasket | User clicks on Add to Basket button |
vviinnAddToFavorite | User clicks on Favorite button |
vviinnProductClick | Emitted on a click on a link in the card, instead of following the link |
vviinnProductLoad | Emitted once when the card has rendered |
vviinnProductView | Emitted when at least 95% of the card's image is visible |
Replace texts and icons with your own content: Replace Widget Content.
| Slot | Description |
|---|---|
vviinn-basket-button-icon | Icon of Add to Basket button. |
vviinn-basket-button-icon-pressed | Icon of pressed Add to Basket button (Set mode). |
vviinn-basket-button-text | Text of Add to Basket button. |
vviinn-basket-button-text-pressed | Text of pressed Add to Basket button (Set mode). |
vviinn-custom-label-0 | Custom label with index 0. |
vviinn-custom-label-1 | Custom label with index 1. |
vviinn-custom-label-2 | Custom label with index 2. |
vviinn-custom-label-3 | Custom label with index 3. |
vviinn-custom-label-4 | Custom label with index 4. |
vviinn-energy-label-data-sheet-text | Data sheet link's text. |
vviinn-favorite-icon | Icon of Favorite button. |
vviinn-favorite-icon-pressed | Icon of pressed Favorite button. |
vviinn-image-placeholder-icon | Icon or content for the image placeholder. |
vviinn-product-card-actions | Add action buttons like One-Click Discovery to this slot. |
vviinn-update-button-icon | Icon of Update Button (Set mode). |
Shadow Parts
Section titled “Shadow Parts”Style these elements with vviinn-product-card::part(name): Styling Specific Elements.
| Part | Description |
|---|---|
basket-button | Add to Basket button. |
basket-button-container | Product Card's basket button container. |
brand | Product brand. |
content-card | Content card container. Styled through an embedding widget, e.g. vviinn-results::part(content-card). |
content-card-content-container | Content card's content container. |
content-card-image | Content card's image. |
content-card-image-container | Content card's image container. |
content-card-image-picture | Picture element for content card's image. |
content-container | Product Card's content container. On content cards, not exported to the widgets. |
content-label | Content card's label. |
content-link | Content card's link. |
content-title | Content card's title. |
currency | Currency sign. Renders after price-amount. |
custom-label-0 | Custom label with index 0. |
custom-label-1 | Custom label with index 1. |
custom-label-2 | Custom label with index 2. |
custom-label-3 | Custom label with index 3. |
custom-label-4 | Custom label with index 4. |
custom-label-content | Custom labels in the content area. Combine with custom-label-N to pick one place. |
custom-label-image | Custom labels on the image. Combine with custom-label-N to pick one place. |
deeplink | Anchor element for title. Rendered only if "deeplink" property is filled. |
discount-label | Discount label in Product Card (Set mode). |
discount-percentage | Discount percentage inside the Add to Basket button (Set mode). |
energy-label-container | Energy label container. |
energy-label-data-sheet-link | Data sheet link. |
energy-label-icon | Icon with an energy class. |
energy-label-product-type | Product type. |
favorite-button | Favorite button. |
image | Product image. |
image-container | Product Card's image container. |
image-link | Anchor element for image. Rendered only if "deeplink" property filled. |
image-picture | Picture element for image. |
image-placeholder | Placeholder shown when no image is available. |
image-skeleton | Placeholder shown while the image loads. |
list-card | List card container. Styled through an embedding widget, e.g. vviinn-results::part(list-card). |
list-card-content-container | List card's content container. |
list-card-image | List card's image. |
list-card-image-container | List card's image container. |
list-card-image-picture | Picture element for list card's image. |
list-container | Same element as list-card-content-container. Not exported to the widgets. |
list-label | List card's label (e.g., "Category"). |
list-title | List card's title. |
price-amount-base-outdated | Numeric part of the regular price per unit shown as outdated. |
price-amount-base-regular | Numeric part of the regular price per unit. |
price-amount-base-sale | Numeric part of the sale price per unit. |
price-amount-outdated | Numeric part of the regular price shown as outdated. |
price-amount-regular | Numeric part of the regular price. |
price-amount-sale | Numeric part of the sale price. |
price-container | Wrapper around the price values. Rendered only if "add-price-container" property is set. |
price-outdated | Renders when "sale-price" property filled. Contains regular price. |
price-prefix | Renders before price-amount. Can be set with "price-prefix" property or inherited from parent component. |
price-regular | Renders when "sale-price" property is empty. |
price-sale | Renders when "sale-price" property filled. Contains sale price. |
product-card | Card container. Styled through an embedding widget, e.g. vviinn-results::part(product-card). |
product-card-actions | Style actions wrapper. |
product-card-actions-top | Style top actions wrapper. |
product-images-pagination | Container for product images pagination dots (mobile only). |
product-images-pagination-bullet | Individual pagination dot. |
product-images-pagination-bullet-active | Active pagination dot. |
product-type | Product type. |
title | Product title |
update-button-item | Update button in Product Card (Set mode). |
CSS Custom Properties
Section titled “CSS Custom Properties”Set them on vviinn-product-card or a parent element: CSS Variables.
| Property | Description |
|---|---|
--basket-button-bg-color-pressed | The background color of the pressed Basket Button. |
--font-family | The font family of the product card. |
--product-card-content-align | The alignment of the content inside the product card's flex container. |
--product-card-image-aspect-ratio | The aspect ratio of the product card image (e.g., "1 / 1", "3 / 4"). |
--product-card-image-bg-color | The background color of the product card image. |
--product-card-image-border | The border of the product card image. |
--product-card-text-align | The alignment of the text inside the product card. |
--product-card-transition-duration | Duration of skeleton to content transitions. |