Skip to main content
On this page

Cards group related content or controls into a distinct, bounded section.

When to use​

  • To visually separate a self-contained piece of content from the surrounding page
  • To group related fields, details, or controls that belong to the same subject
  • As the structural container for more complex components such as AccordionGroup or banners
  • When you need a clearly bounded section within a page that does not warrant a full page region

When not to use​

  • For tabular data - use Data Table instead, which provides sorting, alignment, and header semantics that a Card cannot.
  • For key-value pairs - use Summary List instead, which is designed for displaying labelled data.
  • As a clickable navigation element - card has no interactive semantics. If the whole card should be clickable, use a CTA Link or CTA Button as the primary action, and keep the card itself non-interactive.
  • For brief status information attached to an object - use Badge instead.

Anatomy​

  1. Container (the bordered, rounded surface that holds the card's content)
  2. Content area (the padded inner region; accepts any child components)

Basic usage​

Loading...
Edit live code
<Card>
  <Heading2>Plastic Recycling</Heading2>
  <P>
    Nearly all types of plastics can be recycled. However, the extent to which they are recycled depends upon technical, economic and logistic factors.
  </P>
</Card>

Variants and features​

Other HTML elements​

By default, Card renders as a div. Use the as prop (from styled-components) to render as a different semantic element when the content warrants it.

  • Use as="section" when the card represents a landmark region with a heading
  • Use as="article" when the card's content is independently distributable
  • Use as="fieldset" when the card groups related form fields (pair with a legend)

A card as a landmark region, with its heading naming the region:

Loading...
Edit live code
<Card as="section" aria-labelledby="usage-heading">
  <Heading2 id="usage-heading">Your usage</Heading2>
  <P>You used 212 kWh of electricity last month.</P>
</Card>

A card as a fieldset, grouping related form fields. The legend must be the first element inside it:

Loading...
Edit live code
<Card as="fieldset">
  <Heading3 as="legend">Supply address</Heading3>
  <FormFields>
    <TextField id="address-line-1" label="Address line 1" />
    <TextField id="address-town" label="Town or city" />
    <TextField id="address-postcode" label="Postcode" characters={8} />
  </FormFields>
</Card>

The inline prop is deprecated and must not be used.

Composition​

Card is a general-purpose container. There are no restrictions on what it can contain, but some patterns work better than others.

Keep each card focused on a single subject. A card that covers too many topics forces users to read everything to find what they need. If you find yourself splitting a card with internal headings into many sub-sections, consider whether the content should be broken into multiple cards or moved to its own page.

Limit the number of actions in a card. A single primary action is appropriate. If you need more, use one primary and one secondary action at most.