Skip to the content

Card

Card is a grid surface with named slots — media, title, content and action — for one entity with its own identity: a product, a plan, a post. It paints surface.paper with a hairline border; a string title or description gets the heading or body typography automatically.
Layout & Surfaces

When to use

Use when
  • An entity combines media, text and an action, such as a product tile with a photo and a button.
  • Items in a list or grid need consistent border, padding and equal-height footers.
  • The slot layout must re-arrange with the width of the slot the Card sits in.
Avoid when
  • The block has no title or action — use Paper.
  • You need a dialog — use Modal.

Usage

loading

children and description render in the same content area, description first; passing both keeps both. Do not wrap a string title in your own Text.

Media

The media slot is full-bleed: it meets the Card's top and side edges and inherits the corner radius, while the padding stays on the text slots below.

A title here

<Card
  width={300}
  title="A title here"
  media={<Image cover src={cover} />}
  actionComponent={<Button fullWidth text="Accept" variant="contained" />}
>
  {rating}
</Card>

Equal-height tiles

The default template follows the slots present. With an action, the content row takes the leftover space (auto 1fr auto), so the footer pins to the foot of each tile. interactive adds a hover and focus lift — primary border, glow, 2px rise — and sets overflow to visible so the glow is not clipped.

Short

One line

Longer

Two lines of copy that make the content row grow while the action stays at the foot.

<Grid medias={{ columns: '1fr 1fr', gap: 'medium' }} height={280}>
  <Card height="100%" title="Short" description="One line" actionComponent={<Link href="#" text="Go" />} />
  <Card height="100%" interactive title="Longer" description="…" actionComponent={<Link href="#" text="Go" />} />
</Grid>

Re-arranging the slots

Card takes the same template channels as Grid, with the area names media, title, content and action. A flat medias replaces the default template; cq re-arranges by the width of the nearest ancestor with containment; viewportMedias follows the viewport.

<Flex containment="inline-size">
  <Card
    title="Media beside text from md"
    media={<Image cover src="…" alt="…" />}
    cq={{ md: { columns: '160px 1fr', rows: 'auto 1fr', areas: '"media title" "media content"' } }}
  />
</Flex>

The Card is itself an inline-size container, so slot content can use cq against the Card's width.

Accessibility

  • A string title renders as an <h4>. Pass a node when the page outline needs another level.
  • For a tile that navigates, render the Card as a link with as="a" and href; keep other interactive elements out of it.
  • Give media images an alt, or an empty alt when they are decorative.

Properties

Every layout prop also applies and is not repeated here.

See also