Skip to content

Card

A panel on the page, ready as is: the surface background, a subtle hairline, a radius rounder than the controls inside it (12px around 8px) and component padding. Add ms-surface to use tones, hover and the background / border utilities on it.

Example

Works offline

Nothing leaves your computer.

Hover me

The hairline turns to the tone.

Toned

A surface variant paints the card instead.

<div
  class="ms-grid ms-grid--display-grid ms-grid--columns-3 ms-layout ms-layout--gap-size-base"
>
  <div class="ms-card ms-surface">
    <strong>Works offline</strong>
    <p class="ms-text--color-muted">Nothing leaves your computer.</p>
  </div>
  <div class="ms-card ms-surface ms-surface--hover-border">
    <strong>Hover me</strong>
    <p class="ms-text--color-muted">The hairline turns to the tone.</p>
  </div>
  <div class="ms-card ms-surface ms-surface--variant-soft ms-tone-success">
    <strong>Toned</strong>
    <p>A surface variant paints the card instead.</p>
  </div>
</div>

Flush

ms-card--flush (crdIsFlush) drops the padding, so a table, an accordion or a list of rows reaches the edges, clipped to the rounded corners. An accordion inside keeps its text at the card's padding (its rows, lines and focus ring still reach the edges), and the card's border closes its last row.

Provider Kept for
Cloudflare Minutes to hours
PostHog 1 year
<div class="ms-card ms-card--flush ms-surface">
  <table class="ms-table ms-table--size-base">
    <thead>
      <tr>
        <th class="ms-table__cell" scope="col">Provider</th>
        <th class="ms-table__cell" scope="col">Kept for</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="ms-table__cell">Cloudflare</td>
        <td class="ms-table__cell">Minutes to hours</td>
      </tr>
      <tr>
        <td class="ms-table__cell">PostHog</td>
        <td class="ms-table__cell">1 year</td>
      </tr>
    </tbody>
  </table>
</div>

Usage

<div class="ms-card ms-surface">…</div>
<div class="ms-card ms-card--flush ms-surface">…</div>
<div class="ms-card ms-surface ms-surface--variant-soft ms-tone-success">…</div>
<div class="ms-card ms-surface ms-surface--hover-border">…</div>
Prop Values
crdIsFlush no padding, content clipped to the rounded corners

In React, CardBasic is the card: no props needed. srfAs renders it as another tag (li in a list, nav), and crdIsInteractive makes the whole card the click target of one stretched link inside it.

Customize: --ms-card-padding, --ms-card-radius, --ms-card-border-width, --ms-card-background, --ms-card-border-color (see tokens).