Skip to main content
DataCard
@coinbase/cds-web@8.38.5
A flexible card component for displaying data with visualizations like progress bars and circles. It supports horizontal and vertical layouts with customizable thumbnails and title accessories.
import { DataCard } from '@coinbase/cds-web/alpha/data-card'

DataCard is a flexible card component for displaying data with visualizations. It wraps CardRoot and provides a structured layout for thumbnails, titles, subtitles, and visualization content like progress bars or circles.

Migration from Legacy DataCard

The new DataCard from @coinbase/cds-web/alpha/data-card replaces the legacy DataCard. The new version provides more flexibility with custom layouts and visualization components.

Before:

import { DataCard } from '@coinbase/cds-web/cards/DataCard';

<DataCard
title="Progress"
description="45% complete"
progress={0.45}
progressVariant="bar"
startLabel="0"
endLabel="45"
/>;

After:

import { DataCard } from '@coinbase/cds-web/alpha/data-card';

<DataCard
title="Progress"
subtitle="45% complete"
layout="vertical"
thumbnail={<RemoteImage src={assetUrl} shape="circle" size="l" />}
>
<ProgressBarWithFixedLabels startLabel={0} endLabel={45} labelPlacement="below">
<ProgressBar accessibilityLabel="45% complete" progress={0.45} weight="semiheavy" />
</ProgressBarWithFixedLabels>
</DataCard>;

Basic Examples

DataCard supports two layouts: vertical (stacked) and horizontal (side-by-side). Pass visualization components as children.

Loading...

Layout Variations

Use layout="vertical" for stacked layouts (thumbnail on left, visualization below) or layout="horizontal" for side-by-side layouts (header on left, visualization on right).

Loading...

Title Accessory

Use titleAccessory to display supplementary information inline with the title, such as trends, percentages, or status indicators.

Loading...

Interactive Cards

Use renderAsPressable to make the card interactive. You can render as a button with onClick or as a link with as="a" and href.

Loading...

Style Customization

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

Loading...

Multiple Cards

DataCards work well in lists or dashboards to display multiple data points.

Loading...

With LineChart

DataCard can also display chart visualizations like LineChart for showing price trends or time-series data.

Loading...

Accessibility

Ensure all visualization components have appropriate accessibilityLabel props to convey the progress information to screen readers.

Loading...

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.