Site and editorial

Card grid

<forma-card-grid>

Ruled grid of cards with a column cap and content-driven column dropping; card links stretch without making the whole card the accessible name.

Authoring tag
<forma-card-grid>
Behavior owner
Site content
Canonical source
patterns/card-grid.html

Purpose

A card grid presents a set of parallel items (services, capabilities, products) as a list of article.forma-card elements separated by shared hairline rules. data-forma-columns caps the number of columns; the minimum card width (--forma-layout-card-min, 15rem) decides when a column drops, so the grid degrades to one column by content rather than by breakpoints. A card may contain one .forma-card__link in its title: the link stretches over the whole card for pointer and touch, while its accessible name stays the title text.

Use when

  • Presenting three to a dozen parallel items that each have a title and a short description.
  • Each item may link to its own page and the whole card should be a comfortable target.
  • Items should align into rows on wide screens and stack on phones without custom CSS.

Avoid when

  • The items are ordered or numbered: use Entry index or Steps.
  • Each item is a single short claim with a supporting line: use Facts.
  • An application dashboard needs metric tiles or interactive panels: use Metric card or Dashboard grid.
  • A card needs several independent links or controls; the stretched link covers the card, so extra links would be unreachable by pointer.

Behavior to know

  • Cards inside a grid share single hairline rules; standalone cards keep a full border and radius.
  • Cards default to the surface tone; data-forma-tone can set page, elevated (adds a raised shadow) or inverse.
  • Card titles size by role, not heading level, so the outline can use whichever level the page needs.
  • A linked card shows hover as a surface color change and draws the focus ring on the whole card.

Basic example

The smallest correct markup: the canonical pattern from patterns/card-grid.html inside its public tag. Copy this first, then adapt labels, names and state.

Canonical

Minimal card grid

Rendered from the canonical pattern file.

Static specimen. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.

  • Constrain

    Make valid work explicit

    Domain state and legal transitions are modeled instead of implied.

  • Verify what people receive

    Accessibility, responsiveness, and meaning are checked as executable contracts.

HTML · Minimal card grid Raw HTML for HTML · Minimal card grid
<forma-card-grid class="forma-component-tag">
<div class="forma-site">
  <ul class="forma-card-grid" data-forma-columns="3" aria-label="Capabilities">
    <li>
      <article class="forma-card">
        <p class="forma-eyebrow">Diagnose</p>
        <h3 class="forma-card__title"><a class="forma-card__link" href="#diagnose">Prove what is wrong before changing it</a></h3>
        <p>Observations stay separate from explanations until evidence removes the alternatives.</p>
        <p class="forma-card__footer">Outcome: a defensible root cause</p>
      </article>
    </li>
    <li>
      <article class="forma-card">
        <p class="forma-eyebrow">Constrain</p>
        <h3 class="forma-card__title">Make valid work explicit</h3>
        <p>Domain state and legal transitions are modeled instead of implied.</p>
      </article>
    </li>
    <li>
      <article class="forma-card" data-forma-tone="inverse">
        <h3 class="forma-card__title">Verify what people receive</h3>
        <p>Accessibility, responsiveness, and meaning are checked as executable contracts.</p>
      </article>
    </li>
  </ul>
</div>
</forma-card-grid>

Click or tap the code once to select all of it, then copy.

Examples

Scenario

Two-column linked services

Two linked service cards with footers stating the outcome. Each whole card is a target, but each link's accessible name is only its title. data-forma-columns="2" stops the grid at two columns even on very wide screens.

Live demo. 2 native actions work here and are verified by an outcome test.

HTML · Two-column linked services Raw HTML for HTML · Two-column linked services
<forma-card-grid class="forma-component-tag">
  <div class="forma-site">
    <ul class="forma-card-grid" data-forma-columns="2" aria-label="Services">
      <li>
        <article class="forma-card">
          <p class="forma-eyebrow">Diagnostic</p>
          <h3 class="forma-card__title"><a class="forma-card__link" href="#card-grid-linked-services-diagnostic">Find the cause of a recurring failure</a></h3>
          <p>A two-week engagement that separates observations from explanations.</p>
          <p class="forma-card__footer" id="card-grid-linked-services-diagnostic">Outcome: a defensible root cause</p>
        </article>
      </li>
      <li>
        <article class="forma-card">
          <p class="forma-eyebrow">Architecture</p>
          <h3 class="forma-card__title"><a class="forma-card__link" href="#card-grid-linked-services-architecture">Model the rules your system must keep</a></h3>
          <p>Domain state and legal transitions become explicit and testable.</p>
          <p class="forma-card__footer" id="card-grid-linked-services-architecture">Outcome: executable constraints</p>
        </article>
      </li>
    </ul>
  </div>
</forma-card-grid>

Click or tap the code once to select all of it, then copy.

Scenario

Five-column product family

Five short, unlinked product cards. data-forma-columns="5" also lowers the card minimum to 12rem so five columns fit on wide screens; they drop to fewer columns as the container narrows. One card uses the elevated tone and gains a raised shadow.

  • Ordo

    Domain state and legal transitions.

  • Limen

    Interface behavior at the boundary.

  • Dokimos

    Longitudinal quality evidence.

  • Vigila

    Operational monitoring.

  • Forma

    Presentation and layout.

HTML · Five-column product family Raw HTML for HTML · Five-column product family
<forma-card-grid class="forma-component-tag">
  <div class="forma-site">
    <ul class="forma-card-grid" data-forma-columns="5" aria-label="Products">
      <li><article class="forma-card"><h3 class="forma-card__title">Ordo</h3><p>Domain state and legal transitions.</p></article></li>
      <li><article class="forma-card"><h3 class="forma-card__title">Limen</h3><p>Interface behavior at the boundary.</p></article></li>
      <li><article class="forma-card"><h3 class="forma-card__title">Dokimos</h3><p>Longitudinal quality evidence.</p></article></li>
      <li><article class="forma-card"><h3 class="forma-card__title">Vigila</h3><p>Operational monitoring.</p></article></li>
      <li><article class="forma-card" data-forma-tone="elevated"><h3 class="forma-card__title">Forma</h3><p>Presentation and layout.</p></article></li>
    </ul>
  </div>
</forma-card-grid>

Click or tap the code once to select all of it, then copy.

Mobile

Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.

Mobile example

Phone single column

Three capability cards at phone width, one linked and one on the inverse tone. The grid collapses to a single column and each card spans the full width.

Live demo. 1 native action works here and is verified by an outcome test.

Viewport width

Frames narrower than the selected width show the component at the width available.

What changes at narrow widths

  • Columns drop by content: below about two 15rem cards the grid is one column, whatever data-forma-columns says.
  • Shared hairline rules remain, so stacked cards read as one ruled list without doubled borders.
  • The stretched card link makes the whole card a large touch target; the title text is still the link's accessible name.
  • Long titles wrap within a 24ch measure and card padding shrinks with the fluid block-space token, so nothing overflows at 320px.
HTML · Phone single column Raw HTML for HTML · Phone single column
<forma-card-grid class="forma-component-tag">
  <div class="forma-site">
    <ul class="forma-card-grid" data-forma-columns="3" aria-label="Capabilities">
      <li><article class="forma-card"><p class="forma-eyebrow">Diagnose</p><h3 class="forma-card__title"><a class="forma-card__link" href="#card-grid-mobile-single-column-verify">Prove what is wrong before changing it</a></h3><p>Evidence removes the alternatives.</p></article></li>
      <li><article class="forma-card"><p class="forma-eyebrow">Constrain</p><h3 class="forma-card__title">Make valid work explicit</h3><p>Legal transitions are modeled, not implied.</p></article></li>
      <li><article class="forma-card" data-forma-tone="inverse" id="card-grid-mobile-single-column-verify"><h3 class="forma-card__title">Verify what people receive</h3><p>Accessibility and meaning are executable contracts.</p></article></li>
    </ul>
  </div>
</forma-card-grid>

Click or tap the code once to select all of it, then copy.

Baseline

Mobile · 320px

The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.

Static specimen. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.

Viewport width

Frames narrower than the selected width show the component at the width available.

API and configuration

Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.

Native and ARIA attributes
AttributeOnValuesDefaultDescription
aria-labelul.forma-card-gridstring—Names the list when no visible heading introduces it.
hrefa.forma-card__linkURL—Destination of the card. Use at most one card link per card.
CSS hooks (derived from dist/all.css)
HookKindValues or defaultDescription
.forma-card-gridBlock class—Unstyled list laid out as an auto-fit grid. Draws the top and inline-start rules; each card draws its end and bottom rules.
[data-forma-columns]Attribute hook"2", "3", "4", "5"Column cap on the grid: 2, 3, 4 or 5. Without it the cap is 12. 5 also lowers the card minimum to 12rem. The minimum card width still decides when columns drop.
.forma-cardBlock class—Card article. Positioned so a card link can stretch over it; defaults to the surface tone and a full border when standalone.
.forma-card__footerElement class—Closing line (outcome, meta) separated by a strong rule.
.forma-card__linkElement class—Link inside the title. Its ::after pseudo-element covers the card to enlarge the target; the focus ring is drawn on the card.
.forma-card__titleElement class—Card title at the h3 role size in the body face, whatever its heading level. Capped at 24ch.
[data-forma-tone]Attribute hook"elevated"Tone of a card: surface (default), page, elevated (adds a raised shadow) or inverse.
--forma-card-ruleCustom propertydefault var(--forma-tone-rule)Color of the grid's shared hairline rules. Default the tone's rule color.
--forma-card-columnsCustom property—Column cap computed from data-forma-columns (default 12). Prefer the attribute over setting this directly.
Keyboard interaction
KeysResult
Tab / Shift+TabMoves between card links; unlinked cards are not focusable.
EnterFollows the focused card link (native link behavior).

States

Card grid states
StateHow it is expressedPresentation
Static cardno .forma-card__linkNot interactive; no hover or focus treatment.
Linked card hover:has(.forma-card__link:hover)The card background changes to the tone's hover surface and the title underlines.
Linked card focus:has(.forma-card__link:focus-visible)The focus outline and halo are drawn inside the card edge instead of around the title.
Elevateddata-forma-tone="elevated"Elevated surface with a raised shadow.
Inversedata-forma-tone="inverse"Inverse surface; text, labels and rules switch to inverse tone colors.

Accessibility

Forma provides

  • Keeps the link's accessible name to the title while the whole card is the pointer and touch target.
  • Draws a visible focus ring on the whole card for linked cards.
  • Uses rules and tone pairs validated for contrast; the card link inherits the title color, and other links on the surface tone fall back to primary text because the accent is not validated there.
  • Borders tones in forced colors and keeps cards whole across printed pages.

Your application supplies

  • Mark up the grid as a list of article cards with real headings at the level the outline needs.
  • Name the list with aria-label or a preceding heading.
  • Use at most one link per card and write titles that make sense out of context.

Responsive behavior

  • Auto-fit grid with minmax(min(100%, max(--forma-layout-card-min, 100% / columns)), 1fr): the cap limits columns and the 15rem minimum (12rem for five columns) drops them.
  • At phone widths every cap degrades to one column; there are no breakpoints.
  • Cards have min-inline-size: 0 and titles wrap within 24ch, so long words and titles do not overflow.

Motion

  • A linked card interpolates its background color on hover over the shared perceptual duration (about 120ms). Nothing moves or scales.
  • Unlinked cards do not animate. Under reduced motion the color change is instant.

Usage guidance

Do

  • Keep card content parallel: same parts, similar length.
  • Use data-forma-columns to match the number of items (2 for two, 3 for three or six).

Avoid

  • Placing buttons or secondary links inside a linked card.
  • Using tone to rank items; tone is presentation, not importance.

Verification specimens

Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.