---
title: ProductCardGroup
---

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

# ProductCardGroup

```jsx live
function ProductCardGroupExample() {
  const image = {
    src: '/universal-design-system/img/iPhone_15_Pro_Max.png',
    alt: 'iPhone 15 Pro Max'
  }
  return (
    <>
      <ProductCardGroup
        productCards={[
          {
            image,
            id: 'first'
          },
          {
            image,
            id: 'second'
          },
          {
            image,
            id: 'third'
          },
          {
            image,
            id: 'fourth'
          }
        ]}
      />
    </>
  )
}
```

## Introduction

A `ProductCardGroup` renders a group of [ProductCard](product-card)s, which display
product information, and allows the selection of one or more option from a group of many.

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

## Guidance

- Use the `ProductCardGroup` component to display a group of product cards.
- Use the `maxSelection` prop to allow more than one item to be selected. Pass a number to set that as the maximum, or `null` to have no maximum and allow any number of selections.
- Use the `dictionary` prop to pass custom text to the `ProductCard` component.
- Each `ProductCard` component should have a unique `id` prop.

### Define max selection

Use the `maxSelection` prop to allow more than one item to be selected. Pass a number to set that
as the maximum, or `null` to have no maximum and allow any number of selections.

```jsx live
function ProductCardGroupMaxSelectionExample() {
  const image = {
    src: '/universal-design-system/img/iPhone_15_Pro_Max.png',
    alt: 'iPhone 15 Pro Max'
  }

  return (
    <>
      <ProductCardGroup
        maxSelection={2}
        productCards={[
          {
            image,
            id: 'first'
          },
          {
            image,
            id: 'second'
          },
          {
            image,
            id: 'third'
          },
          {
            image,
            id: 'fourth'
          }
        ]}
      />
    </>
  )
}
```

### Custom `dictionary` values

Use the `dictionary` prop to pass custom text to the `ProductCard` component.

```jsx live
function ProductCardGroupDictionaryExample() {
  const image = {
    src: '/universal-design-system/img/iPhone_15_Pro_Max.png',
    alt: 'iPhone 15 Pro Max'
  }
  const dictionary = {
    en: {
      badgeText: 'Certified Pre-owned',
      brandName: 'Apple',
      productName: 'iPhone 15 Pro',
      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é'
    }
  }

  return (
    <>
      <ProductCardGroup
        maxSelection={2}
        productCards={[
          {
            image,
            id: 'first'
          },
          {
            image,
            id: 'second'
          },
          {
            image,
            id: 'third',
            dictionary
          },
          {
            image: {
              src: '/universal-design-system/img/iPhone_15_Pro_Max.png',
              alt: 'iPhone 15 Pro Max'
            },
            id: 'fourth',
            dictionary
          }
        ]}
      />
    </>
  )
}
```

## Props

<PropsTable base={BaseDocs} />

## Feedback

<Feedback component="ProductCardGroup" />
