Card
Group related content and actions in a single surface.
<article class="dv-card">
<header class="dv-card__header"><h4 class="dv-m-0">Website redesign</h4></header>
<div class="dv-card__body">The updated component guides are ready for review.</div>
<footer class="dv-card__footer"><span class="dv-muted">Updated today</span></footer>
</article>Usage
After setting up the CSS, apply dv-card to the container and dv-card__body to the content section. Use an <article> for self-contained content or a <div> for a visual grouping.
<article class="dv-card">
<div class="dv-card__body">Project summary</div>
</article> Examples
Sections and actions
Use the header for a heading, the body for the main content, and the footer for metadata or actions. Place each section directly inside the card and include the sections you need. Choose a heading level that fits the surrounding page.
Project settings
<article class="dv-card">
<header class="dv-card__header"><h4 class="dv-m-0">Project settings</h4></header>
<div class="dv-card__body">Review the options for this project.</div>
<footer class="dv-card__footer"><a href="#api">View card classes</a></footer>
</article> Sizes
Medium is the default. Choose small for dense layouts or large for more space around each section. The parent layout controls the card width.
<article class="dv-card dv-card--sm">
<div class="dv-card__body">Size sm</div>
</article>
<article class="dv-card dv-card--md">
<div class="dv-card__body">Size md</div>
</article>
<article class="dv-card dv-card--lg">
<div class="dv-card__body">Size lg</div>
</article> Appearance and palette
Paper is the default appearance. Use subtle for a tinted surface or solid for a stronger emphasis. Plain, ghost, and text use transparent backgrounds at rest. Choose a palette independently of appearance or inherit the surrounding palette. The playground shows all six appearances and five palettes.
<article class="dv-card dv-color-primary dv-appearance-subtle">
<div class="dv-card__body">In progress</div>
</article>
<article class="dv-card dv-color-success dv-appearance-solid">
<div class="dv-card__body">Complete</div>
</article>
<article class="dv-card dv-color-warning dv-appearance-plain">
<div class="dv-card__body">Review needed</div>
</article> Nested surfaces
A paper card on a paper surface uses the alternate paper background in browsers that support CSS style queries.
<article class="dv-card dv-appearance-paper">
<div class="dv-card__body">Project overview
<article class="dv-card">
<div class="dv-card__body">Milestone summary</div>
</article>
</div>
</article> API reference
| Option | Class | Behavior |
|---|---|---|
| Base | dv-card | Groups content on a rounded surface. Defaults to paper and medium section padding. |
| Sections | dv-card__headerdv-card__bodydv-card__footer | Optional direct children. Each gets the same padding. |
| Size | dv-card--smdv-card--mddv-card--lg | Use one to change section padding. |
| Appearance | dv-appearance-paperdv-appearance-subtledv-appearance-soliddv-appearance-plaindv-appearance-ghostdv-appearance-text | Use one to set the surface and foreground. |
| Palette | dv-color-neutraldv-color-primarydv-color-successdv-color-warningdv-color-danger | Use one to set the palette. Omit it to use the surrounding palette. |
Customization
Set --dv-card-padding on the card to override its section padding. Apply shared radius and surface tokens on a theme container to customize multiple cards.
<article class="dv-card dv-color-primary dv-appearance-subtle" style="--dv-card-padding: var(--dv-space-250);">
<div class="dv-card__body">Custom section spacing</div>
</article> CSS custom properties
| Property | Effect and defaults |
|---|---|
--dv-card-padding | Padding on all sides of each section. Defaults to var(--dv-space-100) for sm, var(--dv-space-200) for md, and var(--dv-space-300) for lg. |
--dv-radius-md | Shared corner radius used by the card. |
--dv-color-paper / --dv-color-paper-alt | Shared backgrounds for paper and alternate paper surfaces. |