Skip to main content
Neighborhood Design System v5.1.0

Product Card

Ready

Product Card is a compact tile of information about a product.

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdProductCard } from '@fbin-web/neighborhood-core';
Usage
<nbhd-product-card
  aspect-ratio="square"
  href="https://shop.moen.com/products/64430"
  identifier="1234CH"
  alignment="center"
  surface="primary">
  <nbhd-image
    width="300"
    provider="widen"
    height="300"
    crop=""
    responsive=""
    image-focus="center"
    loading="lazy"
    slot="media"
    src="https://placehold.co/300x300@2x.png?text=Main"
    alt="Product Image for one-handle high arc bathroom faucet - 1234CH">
  </nbhd-image>

  <nbhd-image
    width="300"
    height="300"
    provider="widen"
    crop=""
    responsive=""
    image-focus="center"
    aria-hidden="true"
    slot="media-alternate"
    src="https://placehold.co/300x300@2x.png?text=Hover"
    alt="Alternate Product Image for one-handle high arc bathroom faucet - 1234CH">
  </nbhd-image>

  <nbhd-text
    tag="h3"
    slot="title">
    one-handle high arc bathroom faucet
  </nbhd-text>

  <nbhd-text
    slot="identifier"
    tag="span">
    1234CH
  </nbhd-text>

  <nbhd-text
    slot="price"
    tag="div">
    $99.99 - $499.99
  </nbhd-text>

  <nbhd-finish
    slot="product-option"
    name="Chrome"
    href="https://shop.moen.com/products/64430?variant=51371978850614"
    identifier="1234CH"
    image="https://moen.widen.net/content/3d7ihxrfrz/jpeg/chrome_100.jpeg"
    active="">
  </nbhd-finish>

  <nbhd-finish
    slot="product-option"
    name="Matte Black"
    href="https://shop.moen.com/products/64430?variant=51371978850614"
    identifier="1234BL"
    image="https://moen.widen.net/content/6kgdjugniw/png/black_100.png">
  </nbhd-finish>

  <nbhd-finish
    slot="product-option"
    name="Brushed Nickel"
    href="https://shop.moen.com/products/64430?variant=51371978850614"
    identifier="1234BN"
    image="https://moen.widen.net/content/gicpetnrh6/png/brushed_nickel_100.png">
  </nbhd-finish>

  <nbhd-finish
    slot="product-option"
    name="Oil Rubbed Bronze"
    href="https://shop.moen.com/products/64430?variant=51371978850614"
    identifier="1234ORB"
    image="https://moen.widen.net/content/8v7bnmmfok/png/oil_rubbed_bronze_100.png">
  </nbhd-finish>

  <nbhd-finish
    slot="product-option"
    name="Brushed Gold"
    href="https://shop.moen.com/products/64430?variant=51371978850614"
    identifier="1234BG"
    image="https://moen.widen.net/content/r9lgtpuzuj/png/brushed_gold_100.png">
  </nbhd-finish>

  <nbhd-finish
    slot="product-option"
    name="White"
    href="https://shop.moen.com/products/64430?variant=51371978850614"
    identifier="1234WH"
    image="https://moen.widen.net/content/mdhhn8qalr/png/white_100.png">
  </nbhd-finish>

  <nbhd-finish
    slot="product-option"
    name="Stainless Spot Resist"
    href="https://shop.moen.com/products/64430?variant=51371978850614"
    identifier="1234SSR"
    image="https://moen.widen.net/content/3cyx5y06ko/png/stainless_spot_resist_100.png">
  </nbhd-finish>
</nbhd-product-card>

Usage

  • Product Card is an extension of Card component and includes additional features specific to product display.

Properties

PropertyAttributeTypeDefaultDescription
cssClasscss-classstring—Additional CSS class names to apply to the card.
shadowshadowbooleanfalseIf true, the card will have a shadow.
alignmentalignmentstartcenterendcenterThe alignment of the card content.
surfacesurfacenoneprimarysecondaryinverseinverse-secondaryprimaryThe surface theme of the card.
reversereversebooleanfalseIf true, the card layout will be reversed.
aspectRatioaspect-ratiosquarelandscapeportraitlandscapeThe aspect ratio of the card media.
zoomzoombooleanfalseIf true, the card media will zoom on hover.
mediaInsetmedia-insetbooleanfalseIf true, the card media will have an inset style.
layoutlayoutstackedinlinefeaturedstackedThe layout of the card.
ariaLabelaria-labelstring—Overrides the accessible name of a clickable card. The card is otherwise named by its visible title, so only set this when needed, and start it with the visible title text (WCAG 2.5.3 Label in Name).
clickableclickablebooleanfalseIf true, the card will be rendered as a link or button.
hrefhrefstring—The URL for the card link when clickable is true.
externalexternalbooleanfalseIf true, the card link will open externally when href is provided.
action—functionundefined—The action to execute when the card is clicked. Requires clickable to be true. A transparent button stretched over the card takes the click, so the card’s title keeps its heading semantics; the button is named by the title.
badges—string[]The badges to display on the product card. Badges that don’t fit on one line wrap rather than being cut off.
product—ProductContentnull—The product content used to display product details.
identifieridentifierstringundefined—The product identifier.
identifierLabelidentifier-labelstringundefinedModelThe label displayed before the product identifier.
noIdentifierLabelno-identifier-labelbooleanfalseIf true, the product identifier label will not be displayed.

Product Content Structure

Structure for ProductContent objects used in the product property.

PropertyTypeRequiredDescription
titlestringNoThe title of the product content.
identifierstringNoThe identifier of the product content.
imageMediaContentNoThe image data for the product content.
badgesstring[]NoThe badges to display for the product content.

MediaContent Structure

Structure for MediaContent objects used in the product option image property.

PropertyTypeRequiredDescription
srcstringYesThe source URL of the media.
altstringYesThe alternative text for the media.
cssClassstringNoAdditional CSS classes to apply to the media element.
typeimagevideoYesThe type of media content.
cropbooleanNoEnable cropping for the media.
imageFocuscentertoptop-rightrightbottom-rightbottombottom-leftlefttop-leftNoThe focal point for the media image.

Events

NameDescriptionEvent Detail
nbhd-productcard-clickEmitted when the product card link is clicked.{ from: 'product-card', item: ProductCardContent, originalEvent: LinkClickDetail }

Slots

NameDescription
mediaMain product image content.
media-alternateAlternate product image content, displayed when provided.
media-option-imageProduct option image content, displayed when a product option is active.
titleProduct title content.
identifierProduct identifier content.
priceProduct price content.
product-optionProduct option content, such as finish selection components.

CSS Parts

NameDescription
baseThe component's base wrapper.
visualThe visual section containing media content.
badgesThe badges container overlaid on the top-start of the visual.
detailThe detail section containing title, identifier, price, and product option content.
mediaThe main product image slot area.
media-alternateThe alternate product image slot area.
media-option-imageThe product option image slot area.
media-linkThe link wrapper around the media content when href is provided.
title-linkThe link wrapper around the title when href is provided.
titleThe product title slot area.
product-optionThe product option content area.
nbhd-product-card::part(base) {
  /* your styles */
}

CSS Properties

Set these on nbhd-product-card or an ancestor to override the defaults. Token is the design token a default comes from and Value is what it resolves to in core Neighborhood; brands may override them. Properties that adapt to surface follow the light or inverse surface they sit on until you set them.

Product card

PropertyTokenValue Copy
--nbhd-productCard-alignment—center
--nbhd-productCard-badges-gap--nbhd-space-14px
--nbhd-productCard-badges-insetBlockStart--nbhd-space-00px
--nbhd-productCard-badges-insetInline--nbhd-space-00px
--nbhd-productCard-badges-offset--nbhd-space-728px
--nbhd-productCard-badges-zIndex—2
--nbhd-productCard-borderWidth--nbhd-border-width-subtle1px
--nbhd-productCard-hover-borderColor--nbhd-card-borderColortransparent
--nbhd-productCard-identifier-color—inherit
--nbhd-productCard-identifier-fontSize--nbhd-typography-bodySmall-fontSize0.875rem
--nbhd-productCard-identifier-fontWeight--nbhd-typography-bodySmall-fontWeight400
--nbhd-productCard-identifier-letterSpacing—normal
--nbhd-productCard-identifier-lineHeight--nbhd-typography-bodySmall-lineHeight1
--nbhd-productCard-identifier-marginBlock--nbhd-space-00px
--nbhd-productCard-maxInlineSize--nbhd-card-maxInlineSize100%
--nbhd-productCard-media-alternate-opacity—0
--nbhd-productCard-media-main-opacity—1
--nbhd-productCard-media-option-opacity—0
--nbhd-productCard-media-zIndex--nbhd-z-ground0
--nbhd-productCard-paddingBlock--nbhd-space-520px
--nbhd-productCard-paddingInline--nbhd-space-520px
--nbhd-productCard-price-color—inherit
--nbhd-productCard-price-fontSize--nbhd-typography-bodySmall-fontSize0.875rem
--nbhd-productCard-price-fontWeight--nbhd-typography-bodySmall-fontWeight400
--nbhd-productCard-price-letterSpacing—normal
--nbhd-productCard-price-lineHeight--nbhd-typography-bodySmall-lineHeight1
--nbhd-productCard-price-marginBlock--nbhd-space-416px
--nbhd-productCard-productOptions-gridGap--nbhd-space-28px
--nbhd-productCard-productOptions-gridTemplateColumns—repeat(auto-fit, 28px)
--nbhd-productCard-productOptions-marginBlock--nbhd-space-4 --nbhd-space-016px 0px
--nbhd-productCard-title-color—inherit
--nbhd-productCard-title-fontSize--nbhd-typography-subheading-fontSize1.125rem
--nbhd-productCard-title-fontWeight--nbhd-typography-subheading-fontWeight700
--nbhd-productCard-title-letterSpacing—normal
--nbhd-productCard-title-lineHeight--nbhd-typography-subheading-lineHeight1.3
--nbhd-productCard-title-marginBlock--nbhd-space-0 --nbhd-space-50px 20px
--nbhd-productCard-title-textDecoration—none
--nbhd-productCard-title-textTransform—capitalize
--nbhd-productCard-transitionDuration--nbhd-motion-duration-slow0.5s
--nbhd-productCard-transitionProperty—border-color
--nbhd-productCard-transitionTimingFunction--nbhd-motion-easing-standardease

Badge

PropertyTokenValue Copy
--nbhd-badge-fontSize--nbhd-typography-badge-fontSize0.625rem
--nbhd-badge-lineHeight--nbhd-typography-badge-lineHeight1

Card

PropertyTokenValue Copy
--nbhd-card-maxInlineSize—100%

Dependencies

Child components <nbhd-product-card> renders internally. Import them too when you tree-shake.

Used by

Esc
↑ ↓ to move↵ to open