Skip to main content
MediaCard
@coinbase/cds-web@8.38.5
MediaCard displays content with optional media in a contained card layout. Use it to showcase assets, products, or content with a thumbnail, title, subtitle, description, and optional media placement. MediaCard replaces the deprecated FloatingAssetCard and ContainedAssetCard components.
import { MediaCard } from '@coinbase/cds-web/cards/MediaCard'
Related components

MediaCard provides a contained card layout with optional media, ideal for showcasing assets, products, or promotional content. It replaces the deprecated FloatingAssetCard and ContainedAssetCard components.

Basic

At minimum, provide a thumbnail to display visual content and a title for the card heading.

Loading...

Media Placement

Use the media prop to display larger visual content. Control its position with mediaPlacement:

  • start: Media on the left
  • end (default): Media on the right
Loading...

Polymorphic and Interactive

MediaCard supports polymorphic rendering and can be made interactive with renderAsPressable. Use as to change the underlying element.

Loading...

Text Content

Long Text

The card handles long text content with truncation.

Loading...

Custom Content

Use React nodes for custom styled text content.

Loading...

Styling

Use styles and classNames props to customize specific parts of the card.

Loading...

Multiple Cards

Display multiple cards in a carousel.

Loading...

Migration from Deprecated Components

Migrating from ContainedAssetCard

Replace ContainedAssetCard with MediaCard:

// Before
<ContainedAssetCard
header={<RemoteImage source={assets.btc.imageUrl} width="32px" height="32px" />}
title="$309.43"
subtitle="Bitcoin"
description={<Text color="fgPositive">&#x2197;3.37%</Text>}
size="l"
>
<RemoteImage source={ethBackground} ... />
</ContainedAssetCard>

// After
<MediaCard
thumbnail={<RemoteImage source={assets.btc.imageUrl} shape="circle" size="l" />}
title="$309.43"
subtitle="Bitcoin"
description={<Text color="fgPositive">&#x2197;3.37%</Text>}
media={<RemoteImage src={ethBackground} height="100%" width="100%" resizeMode="cover" />}
mediaPlacement="end"
/>

Migrating from FloatingAssetCard

Replace FloatingAssetCard with MediaCard. Note that the floating variation (media outside the card container) is no longer supported:

// Before
<FloatingAssetCard
title="Balancing the Air"
subtitle="Amber V's Artwork"
description="0.5 ETH"
media={<RemoteImage source="/img/nft.png" ... />}
/>

// After
<MediaCard
thumbnail={<RemoteImage source="/img/nft.png" shape="circle" size="l" />}
title="Balancing the Air"
subtitle="Amber V's Artwork"
description="0.5 ETH"
/>

Is this page useful?

Coinbase Design is an open-source, adaptable system of guidelines, components, and tools that aid the best practices of user interface design for crypto products.