Card
A self-contained item, such as an article teaser, on a raised surface.
Our choice: No standard exists: an <article> whose heading holds the one link, so the link name stays short.
Live example
Cards in a grid
<div class="grid" style="--grid-min: 16rem">
<article data-card>
<header>
<h3>Starter plan</h3>
<p>For one person trying things out.</p>
</header>
<p>Free forever, with every component and theme.</p>
<footer>
<a href="#grid-title" data-button="primary small">Choose Starter</a>
</footer>
</article>
<article data-card="link">
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 160'%3E%3Crect width='320' height='160' fill='%233451d1'/%3E%3Ccircle cx='250' cy='40' r='60' fill='%238ea2ff'/%3E%3Crect x='24' y='96' width='140' height='40' rx='8' fill='%23f6f7f9'/%3E%3C/svg%3E" alt="" width="320" height="160">
<header>
<h3><a href="#grid-title">Theming guide</a></h3>
<p>Override semantic tokens to make a theme.</p>
</header>
<p>No build step: set a few custom properties and every component follows.</p>
<footer>
<span data-badge="accent">Guide</span>
<a href="#grid-title" data-button="secondary small">View tokens</a>
</footer>
</article>
<article data-card="link">
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 160'%3E%3Crect width='320' height='160' fill='%2317773a'/%3E%3Cpath d='M0 160 L120 50 L200 120 L260 70 L320 120 V160Z' fill='%235fd38d'/%3E%3C/svg%3E" alt="" width="320" height="160">
<h3><a href="#grid-title">Atoms</a></h3>
<p>Buttons, switches, fields and badges.</p>
</article>
</div>
Attributes
| Attribute or value | Where | Effect |
|---|---|---|
data-card | <article> (or <section>, <li>) | the card |
data-card="link" | the whole card follows the link in its heading |
Children: an optional first <img> (or <picture>, <video>) as media, a heading, body content, and an optional <footer> for actions.
Wrap the heading and a one-line description in a <header> to set them close together, with the description muted, as shadcn/ui's card header does (https://ui.shadcn.com/docs/components/card).
Elevation
--dui-elevation-raised and --dui-elevation-raised-surface (level 1), whose 1px ring draws the edge. The border is transparent; forced colors mode, which drops box-shadow, paints it in canvastext.
Keyboard
| Key | Action |
|---|---|
| Tab | moves to each card's heading link, then to its footer actions |
| Enter | follows the focused link |
Accessibility
- Every card has a heading. Use
<article>when it stands on its own. - Images need
alt, oralt=""when decorative. data-card="link"stretches the heading's link over the card, so the link name is the heading (Inclusive Components). Footer actions stay focusable. Card text cannot be selected with the mouse.
Specifications
- HTML
<article>element - ui.shadcn.com card
- WCAG Link purpose in context
- WCAG Focus visible
- W3C images
See also
How other systems do it
For comparison only; these are not the standard this system follows.
- Apple Human Interface Guidelines: No equivalent
- Material Design 3: Cards
- Vercel Geist: No equivalent