# Stat row

A row of headline numbers, each a small card with a label, the value and a note.

**Our choice:** A composition, not a component: a `.grid` of `data-card` articles, each a muted heading, a lead paragraph with the number in `<strong>` and a small note.

_Diagram: A row of small cards at the top of the content area, each with a label, a large number and a note._

## Live example

### Stat row

```html
<section class="grid" aria-label="This month">
  <article data-card>
    <h3 data-text="small muted">Revenue</h3>
    <p data-text="lead"><strong>€45,231</strong></p>
    <p data-text="small muted">Up 20% on last month</p>
  </article>
  <article data-card>
    <h3 data-text="small muted">New customers</h3>
    <p data-text="lead"><strong>2,350</strong></p>
    <p data-text="small muted">Up 180 on last month</p>
  </article>
  <article data-card>
    <h3 data-text="small muted">Open orders</h3>
    <p data-text="lead"><strong>128</strong></p>
    <p data-text="small muted">12 due to ship today</p>
  </article>
  <article data-card>
    <h3 data-text="small muted">Refunds</h3>
    <p data-text="lead"><strong>€1,204</strong></p>
    <p><span data-badge="warning">3 waiting</span></p>
  </article>
</section>
```

## Accessibility

- Each stat is a card with its label as the heading, so screen reader users can move between stats by heading.
- Write the change in words ("Up 20% on last month"), not only as a colour or an arrow ([WCAG 1.4.1](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html)).
- The row reflows from four columns to one without media queries; for a page of headed sections use the [dashboard](https://github.com/odonckers/domestic-ui/blob/main/dashboard.html) instead.

## Specifications

- [HTML `<article>` element](https://html.spec.whatwg.org/multipage/sections.html#the-article-element)
- [WCAG 1.3.1 Info and Relationships](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html)

## See also

- [Organisms](https://domestic-ui.odonckers.dev/organisms/index.md)
- Source: [`examples/patterns/compositions.html`](https://github.com/odonckers/domestic-ui/blob/main/examples/patterns/compositions.html)

## 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](https://m3.material.io/components/cards/overview)
- Vercel Geist: No equivalent
