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.
Design examples
Section titled “Design examples”An outlined card and a filled card show different emphasis with the same title and label structure.
<section class="specimen">
<div class="columns"><ds-card variant="outlined" width="12" height="12" href="#light"><span slot="label">Photography</span><span slot="title">Rooms of light</span><ds-text literal wrap tone="muted">18 October — 12 November</ds-text></ds-card><ds-card tone="pink" width="12" height="12" href="#sound"><span slot="label">Sound</span><span slot="title">A place to listen</span><ds-text literal wrap>Recordings from the coast</ds-text></ds-card></div>
</section>
<style>
.specimen { width: 100%; min-width: 0; --cell: calc(20px * var(--sf, 1)); }
.specimen .line { width: 100%; }
.specimen .grow { flex: 1; min-width: 0; }
.specimen .muted { color: var(--ds-text-color-muted); }
.specimen .mono { --ds-typeface-regular: var(--ds-typeface-mono); font-variant-numeric: tabular-nums; }
.specimen .value { width: calc(4 * var(--cell)); text-align: right; }
.specimen .mark { display: inline-flex; align-items: flex-end; width: var(--cell); height: var(--ds-control-height); flex: 0 0 var(--cell); }
.specimen .columns { display: flex; flex-wrap: wrap; gap: var(--cell); }
.specimen .columns > * { min-width: 0; }
.specimen fieldset { border: 0; padding: 0; margin: 0; }
.specimen legend { padding: 0; }
.specimen label { display: flex; align-items: flex-end; gap: calc(var(--cell) / 2); min-height: var(--cell); }
.specimen ds-panel { height: calc(10 * var(--cell)); }
</style> Try it
Section titled “Try it”Its name, a title and a picture that runs off the foot. With href the whole card is one link.
<ds-card href="#lists" tone="sharp-blue" width="14" height="18" media="center">
<span slot="label">Lists</span>
<span slot="title">Everything on one grid</span>
<span slot="media" style="display:block;width:calc(var(--ds-unit) * 10);height:calc(var(--ds-unit) * 10);border-radius:var(--ds-radius);background:var(--ds-zenith-blue)"></span>
</ds-card> variant="outlined" draws a 1px line and no fill.
<ds-card variant="outlined" width="16">
<span slot="title">Plans</span>
<ds-text literal wrap>Start free. Upgrade when you need more room.</ds-text>
<ds-button primary>Continue</ds-button>
</ds-card> Use it
Section titled “Use it”<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>| Attribute | What it does |
|---|---|
href | The whole card is one link. |
interactive | The whole card is one press target that fires ds-card-press; use href for a destination. |
tone | A 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. |
variant | filled (the default) or outlined, a 1px line and no fill. |
width, height | The size in whole squares. |
padding | none, small (half a square), medium (one, the default) or large (two). |
media | Where 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). |
disabled | Neither pressed nor followed. |
| Slot | Holds |
|---|---|
label | The thing’s name, muted, on one square. |
title | The 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. |
media | A 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.
Constraints it keeps
Section titled “Constraints it keeps”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.
Accessibility
Section titled “Accessibility”- A card with
hrefis one link and a card withinteractiveone 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.