Media card

Media cards provide a consistent layout to present visual information to merchants. Visual media is used to provide additional context to the written information it's paired with.

Media card component examples

Use to surface educational information about a feature or opportunity.

import {MediaCard} from '@shopify/polaris';
import React from 'react';

function MediaCardExample() {
  return (
    <MediaCard
      title="Getting Started"
      primaryAction={{
        content: 'Learn about getting started',
        onAction: () => {},
      }}
      description="Discover how Shopify can power up your entrepreneurial journey."
      popoverActions={[{content: 'Dismiss', onAction: () => {}}]}
    >
      <img
        alt=""
        width="100%"
        height="100%"
        style={{
          objectFit: 'cover',
          objectPosition: 'center',
        }}
        src="https://burst.shopifycdn.com/photos/business-woman-smiling-in-office.jpg?width=1850"
      />
    </MediaCard>
  );
}

Props

interface MediaCardProps
childrenReact.ReactNode

The visual media to display in the card.

titleReact.ReactNode

Heading content.

descriptionstring

Body content.

primaryAction?

Main call to action, rendered as a basic button.

secondaryAction?

Secondary call to action, rendered as a plain button.

popoverActions?[]

Action list items to render in ellipsis popover.

portrait?boolean

Whether or not card content should be laid out vertically.

Defaults to false.

size?'small' | 'medium'

Size of the visual media in the card.

Defaults to 'medium'.

onDismiss?() => void

Callback when MediaCard is dismissed.

Best practices

Media cards should:

  • Provide merchants with a clear call to action.
  • Always pair text with a visual component, for example, body text paired with an image, video, etc.
  • Use media to enhance the written content. The written content should be able to stand alone without an explanation from the paired media.
  • Show targeted content toward specific audiences to maximize relevance.
  • Be dismissable.

Content guidelines

  • Don’t use media cards as advertisements for your feature. Instead they should educate the merchant about how to accomplish tasks related to the section they’re in.

Title

Media card titles should follow the content guidelines for headings and subheadings.

Body content

Body content should be:

  • Actionable: start sentences with imperative verbs when telling merchants what actions are available to them, especially something new. Don’t use permissive language like “you can”.
Do

Get performance data for all of your sales channels.

Don't

Now you can get performance data for all of your sales channels.

  • Structured for merchant success: always put the most critical information first
  • Clear: use the verb “need” to help merchants understand when they’re required to do something
Do

To buy a shipping label, you need to enter the total weight of your shipment, including packaging.

Don't

To buy a shipping label, you must enter the total weight of your shipment, including packaging.

Call to action

Buttons should be:

Clear and predictable: merchants should be able to anticipate what will happen when they click a button. Never deceive merchants by mislabeling a button.

Do

Buy shipping label

Don't

Buy

  • Action-led: buttons should always lead with a strong verb that encourages action. To provide enough context to merchants use the {verb}+{noun} format on buttons except in the case of common actions like Save, Close, Cancel, or OK.
Do

View shipping settings

Don't

View your settings

  • Scannable: avoid unnecessary words and articles such as the, an, or a.
Do

Add menu item

Don't

Add a menu item



Accessibility

The required title prop gives the media card a level 2 heading (<h2>). This helps with readability and provides structure to screen reader users. It can also accept a ReactNode.

Use actionable language to ensure that the purpose of the media card is clear to all merchants, including those with issues related to reading and language.

    On this page