---
title: PreviewCard
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { PreviewCard, StackView } from '@telus-uds/components-web'
import { PreviewCard as WebDocs } from 'docs/@telus-uds/components-web'
import AvailableOnWebOnly from '../../partials/_platform-considerations-web-only.mdx'
import NoStylisticVariants from '../../partials/_variants-none.mdx'
import VideoLinkWarning from '../../partials/_video-link-warning.mdx'

# PreviewCard

<LibraryInfo
  packageType="Web Component"
  figmaLink="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2F4zJn2Qn6uXOqPP1GVDipy6%2F%25F0%259F%258D%2580-Allium-Components%3Fnode-id%3D4040%253A57263"
/>

```jsx live
<div style={{ maxWidth: '30rem', margin: '0 auto' }}>
  <PreviewCard
    href="https://telus.com"
    tag="Example category"
    title="An article with a headline"
    footer="Footer content"
    fullBleedContent={{
      alt: 'Full Bleed Image Example',
      src: '/universal-design-system/img/pigs-allium-lo.png'
    }}
  />
</div>
```

## Introduction

A PreviewCard is a Card designed for guiding a user to an article based on the article's title and other details.

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

## Guidance

- Showcase and guide users to another page
- Whole card is interactive
- Width expands based on column or container
- Height expands to the tallest PreviewCard in the row
- You can render any content full bleed-style by passing some JSX to the `content` field of the `fullBleedContent` prop:

```jsx live
<PreviewCard
  href="https://telus.com"
  tag="Example category"
  title="An article with a headline"
  footer="Footer content"
  fullBleedContent={{
    alt: 'Full Bleed Image Example',
    position: 'bottom',
    content: (
      <OptimizeImage
        contentfulAssetUrl="/universal-design-system/img/pigs-allium-lo.png"
        alt="guinea pig"
      />
    )
  }}
/>
```

<VideoLinkWarning />

### Accessibility

The entire card is focused as one unit, and screenreaders read the content of each card as
one unit. Multiple cards will therefore be read as a list of semantic links.

### Platform considerations

<AvailableOnWebOnly />

## Props

### PreviewCard

<PropsTable web={WebDocs} />

### PreviewCard.AuthorDate

<PropsTable web={WebDocs.AuthorDate} />

## Tokens

<TokensTable web={WebDocs} component="PreviewCard" />

## Variants

<NoStylisticVariants />

It is similar to `StoryCard`, which has a slightly different layout and includes a `description` field for summarising article content.

### Author and date in `footer`

The `footer` prop may contain any content. Many times, this will be `author` and `date`,
and so a component `PreviewCard.AuthorDate` is provided to facilitate this.

```jsx live
<div style={{ maxWidth: '30rem', margin: '0 auto' }}>
  <PreviewCard
    href="https://telus.com"
    tag="Example category"
    title="An article with a headline"
    footer={<PreviewCard.AuthorDate author="Name Of Author" date="Dec 25, 2021" />}
    fullBleedContent={{
      alt: 'Full Bleed Image Example',
      src: '/universal-design-system/img/pigs-allium-lo.png'
    }}
  />
</div>
```

### Groups of `PreviewCard` components

Multiple `PreviewCard` components may be laid out in a stacking component to give users a selection of articles.

This is an example of three `PreviewCard`s in a responsive `StackView` that flips from horizontal to vertical based on viewport:

```jsx
import { PreviewCard, StackView } from '@telus-uds/components-web'
```

```jsx live
<StackView direction={{ xs: 'column', md: 'row' }} space={{ xs: 2, lg: 3 }}>
  <PreviewCard
    href="https://telus.com"
    tag="Example category"
    title="Short headline"
    footer={<PreviewCard.AuthorDate author="Name Of Author" date="Dec 25, 2021" />}
    fullBleedContent={{
      alt: 'Full Bleed Image Example',
      src: '/universal-design-system/img/pigs-allium-lo.png'
    }}
  />
  <PreviewCard
    href="https://telus.com"
    tag="Example category"
    title="An article with a somewhat longer headline"
    footer={<PreviewCard.AuthorDate author="Name Of Author" date="Dec 25, 2021" />}
    fullBleedContent={{
      alt: 'Full Bleed Image Example',
      src: '/universal-design-system/img/pigs-allium-lo.png'
    }}
  />
  <PreviewCard
    href="https://telus.com"
    tag="Example category"
    title="An article with a much longer headline that wraps over more lines, resulting in taller content"
    footer={<PreviewCard.AuthorDate author="Name Of Author" date="Dec 25, 2021" />}
    fullBleedContent={{
      alt: 'Full Bleed Image Example',
      src: '/universal-design-system/img/pigs-allium-lo.png'
    }}
  />
</StackView>
```

## Feedback

<Feedback component="PreviewCard" />
