---
title: ProductCard
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { ProductCard, FlexGrid } from '@telus-uds/components-base'
import { ProductCard as BaseDocs } from 'docs/@telus-uds/components-base'

# ProductCard

<LibraryInfo />

```jsx live
<ProductCard
  image={{
    src: '/universal-design-system/img/iPhone_15_Pro_Max.png',
    alt: 'iPhone 15 Pro Max'
  }}
  dictionary={{
    en: {
      badgeText: 'Certified Pre-owned',
      brandName: 'Apple',
      productName: 'iPhone 15 Pro Max',
      primaryPrice: {
        price: '19.45',
        signDirection: 'left',
        rateText: '/month'
      },
      secondaryPrice: {
        price: '0',
        signDirection: 'left',
        rateText: 'Upfront'
      },
      term: '24 months | 0% APR Bring-it-Back applied',
      buttonLabel: 'Select this phone',
      selectedButtonLabel: 'Selected phone'
    }
  }}
/>
```

## Introduction

Pattern for displaying product details.

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

- Use `badgeText` to display a Badge
- Use `secondaryPrice` to add a secondary price
- Use `image.src` to add an image source to the product card. When adding an image, remember to add alt text using `image.alt`
- Change the `signDirection` to right, to move the currency symbol for French

### With an Image

```jsx live
<ProductCard
  image={{
    src: '/universal-design-system/img/iPhone_15_Pro_Max.png',
    alt: 'iPhone 15 Pro Max'
  }}
/>
```

### With FlexGrid

```jsx live
<FlexGrid>
  <FlexGridRow>
    <FlexGridCol xs={12} lg={6}>
      <ProductCard />
    </FlexGridCol>
    <FlexGridCol xs={12} lg={6}>
      <ProductCard
        image={{
          src: '/universal-design-system/img/iPhone_15_Pro_Max.png',
          alt: 'iPhone 15 Pro Max'
        }}
      />
    </FlexGridCol>
  </FlexGridRow>
</FlexGrid>
```

### Custom `dictionary` values

`ProductCard` has a default dictionary with the following schema and values:

```json
{
  "en": {
    "badgeText": "Badge text",
    "brandName": "Brand name",
    "productName": "Product name",
    "primaryPrice": {
      "price": "00",
      "signDirection": "left",
      "rateText": "Primary rate"
    },
    "secondaryPrice": {},
    "term": "Term text",
    "buttonLabel": "Button label",
    "selectedButtonLabel": "Selected button label"
  },
  "fr": {
    "badgeText": "Badge text",
    "brandName": "Brand name",
    "productName": "Product name",
    "primaryPrice": {
      "price": "00",
      "signDirection": "right",
      "rateText": "Primary rate"
    },
    "secondaryPrice": {},
    "term": "Term text",
    "buttonLabel": "Button label",
    "selectedButtonLabel": "Selected button label"
  }
}
```

However, `dictionary` prop can be passed to override the default values. Note that when you override the default `dictionary` by passing the prop value, it has to be a complete object fulfilling the schema defined above, both for `en` and `fr`.

```jsx live
<ProductCard
  image={{
    src: '/universal-design-system/img/iPhone_15_Pro_Max.png',
    alt: 'iPhone 15 Pro Max'
  }}
  copy="en" // change to fr to view french copy
  dictionary={{
    en: {
      badgeText: 'Certified Pre-owned',
      brandName: 'Apple',
      productName: 'iPhone 15 Pro Max',
      primaryPrice: {
        price: '19.45',
        signDirection: 'left',
        rateText: '/month'
      },
      secondaryPrice: {
        price: '0',
        signDirection: 'left',
        rateText: 'Upfront'
      },
      term: '24 months | 0% APR Bring-it-Back applied',
      buttonLabel: 'Select this phone',
      selectedButtonLabel: 'Selected phone'
    },
    fr: {
      badgeText: 'Appareils remis en marché',
      brandName: 'Apple',
      productName: 'iPhone 15 Pro Max',
      primaryPrice: {
        price: '19.45',
        signDirection: 'right',
        rateText: '/mois'
      },
      secondaryPrice: {
        price: '0',
        signDirection: 'right',
        rateText: "d'acompte"
      },
      term: '24 mois | TAP de 0% | avec Option retour',
      buttonLabel: 'Sélectionner ce téléphone',
      selectedButtonLabel: 'Téléphone sélectionné'
    }
  }}
/>
```

## Props

<PropsTable base={BaseDocs} />

## Tokens

<TokensTable base={BaseDocs} component="ProductCard" />

## Feedback

<Feedback component="ProductCard" />
