Card

A card shows one thing among others: its name, a title, a line of writing and a picture of it that can run off the card’s foot and end edge and be cut there, never framed. Cards stand side by side in a slide or a grid. The picture stands on the card’s foot, so in a row of cards of one height, with pictures of one aspect ratio, the pictures stand on one level whatever the words above them. A picture is never rounded where it meets the card: its corners on the foot are square, and only the corners towards the words keep a picture’s corner. Ordinary writing still sits straight on the paper; a card is not a box for a page’s paragraphs.

Two exhibition cards

An outlined card and a filled card show different emphasis with the same title and label structure.

A thing shown on its own fill

Its name, a title and a picture that runs off the foot. With href the whole card is one link.

Outlined, with writing

variant="outlined" draws a 1px line and no fill.

<ds-card href="/lists" tone="sharp-blue" width="14" height="22" media="center">
<span slot="label">Lists</span>
<span slot="title">Everything on one grid</span>
<img slot="media" src="lists.webp" alt="A list on a phone" />
</ds-card>
AttributeWhat it does
hrefThe whole card is one link.
interactiveThe whole card is one press target that fires ds-card-press; use href for a destination.
toneA palette colour for the fill (sharp-blue, apple-green, pink, orange…), drawn as its pastel and dim in dark mode, or ink for the ink with the paper’s words. The quiet fill by default.
variantfilled (the default) or outlined, a 1px line and no fill.
width, heightThe size in whole squares.
paddingnone, small (half a square), medium (one, the default) or large (two).
mediaWhere the picture stands: start, center or bleed (on to the end edge and down to the foot, with no corners of its own: the card’s edges cut it square).
disabledNeither pressed nor followed.
SlotHolds
labelThe thing’s name, muted, on one square.
titleThe title in the display size, a square and a half a line, so a title that wraps stays together.
(default)Writing, one square a line.
mediaA picture, on the card’s foot and a square below the words at least.

The corners are a card’s (--ds-radius-card, 4px by default); a product sets --ds-card-corner-size for rounder ones.

card.media-level
A card's picture stands on the card's foot, a square below the words at least, so the pictures of cards side by side stand on one level whatever the words above them.The room a taller card leaves goes above its picture, never below it, so pictures of one height side by side start on one line too. Pictures of different heights side by side take one room (`media-height`, `--ds-card-media-height`) and start on one line, the foot cutting the taller.
card.media-corners
A picture is never rounded where it meets the card's edge: the card cuts it square there, and only a corner standing free inside the card, towards the words, keeps a picture's corner.
  • A card with href is one link and a card with interactive one button: never put a second link or button inside either. Keyboard focus rings it 2px inside.
  • The pointer tints the card; nothing in it moves.

Slide · Row