PPolaris ComponentsConnect an agent

MediaCard

A card that pairs an image or video with a title, description and actions — used for tutorials, announcements and featured content.

Preview

Code

Example.jsx
import { useState } from 'react';
import { MediaCard, BlockStack, InlineGrid, Text } from '@shopify/polaris';

const MEDIA_STYLE = {
  width: '100%',
  height: '100%',
  minHeight: '160px',
  objectFit: 'cover',
  objectPosition: 'center',
};

const MediaImage = ({ alt }) => (
  <img
    alt={alt}
    src="https://cdn.shopify.com/s/files/1/0757/9955/files/empty-state.svg"
    style={{ ...MEDIA_STYLE, background: 'var(--p-color-bg-surface-secondary, #f7f7f7)', padding: '24px' }}
  />
);

export const Example = () => {
  const [dismissed, setDismissed] = useState(false);

  return (
    <BlockStack gap="400">
      <MediaCard
        title="Getting started with online stores"
        primaryAction={{ content: 'Watch the tutorial', onAction: () => {} }}
        secondaryAction={{ content: 'Read the guide', onAction: () => {} }}
        description="Learn how to set up your store, add products, and take your first order in under 20 minutes."
        popoverActions={[{ content: 'Dismiss', onAction: () => setDismissed(true) }]}
      >
        <MediaImage alt="Online store tutorial" />
      </MediaCard>

      {dismissed && (
        <Text as="p" tone="subdued">
          The tutorial card was dismissed from its popover menu.
        </Text>
      )}

      <InlineGrid columns={{ xs: 1, md: 2 }} gap="400">
        <MediaCard
          portrait
          title="Set up shipping rates"
          primaryAction={{ content: 'Set up shipping', onAction: () => {} }}
          description="Charge the right amount at checkout by adding rates for each region you ship to."
        >
          <MediaImage alt="Shipping rates" />
        </MediaCard>

        <MediaCard
          portrait
          size="small"
          title="Turn on abandoned checkout emails"
          primaryAction={{ content: 'Enable emails', onAction: () => {} }}
          description="Recover up to 15% of the carts your customers leave behind."
        >
          <MediaImage alt="Abandoned checkout emails" />
        </MediaCard>
      </InlineGrid>
    </BlockStack>
  );
};