# Dashboard

A grid of summary sections, each with a heading, that reflows to fit the screen.

**Our choice:** No standard exists: a CSS grid of headed `<section>` elements that reflows without media queries.

_Diagram: A dashboard fills the content area with a grid of headed summary sections, such as totals and a chart, that reflow to fit._

## Live example

### Sales overview

```html
<div data-dashboard>
  <section aria-labelledby="tile-open-title">
    <h3 id="tile-open-title">Open orders</h3>
    <p><strong>128</strong> orders, 12 due to ship today</p>
    <p><a href="?view=orders&amp;status=open">View open orders</a></p>
  </section>
  <section aria-labelledby="tile-overdue-title">
    <h3 id="tile-overdue-title">Overdue invoices</h3>
    <p><strong>€8,420.50</strong> across 7 invoices</p>
    <p><span data-badge="warning">3 over 60 days</span></p>
    <p><a href="?view=invoices&amp;status=overdue">View overdue invoices</a></p>
  </section>
  <section aria-labelledby="tile-revenue-title">
    <h3 id="tile-revenue-title">Revenue in March</h3>
    <p><strong>€142,300</strong>, up 6% on February</p>
  </section>
  <section aria-labelledby="tile-quotes-title">
    <h3 id="tile-quotes-title">Quotes to approve</h3>
    <p><strong>5</strong> quotes worth €21,700</p>
    <p><a href="?view=quotes&amp;status=pending">Review quotes</a></p>
  </section>
  <section data-dashboard-tile="wide" aria-labelledby="tile-recent-title">
    <h3 id="tile-recent-title">Recent invoices</h3>
    <section data-scroll="inline" aria-labelledby="recent-invoices" tabindex="0">
      <table>
        <caption id="recent-invoices">Last four invoices</caption>
        <thead>
          <tr><th scope="col">Invoice</th><th scope="col">Customer</th><th scope="col">Status</th><th scope="col">Amount</th></tr>
        </thead>
        <tbody>
          <tr><td>INV-2025-0318</td><td>Analytical Engines Ltd.</td><td>Part paid</td><td>€1,240.00</td></tr>
          <tr><td>INV-2025-0317</td><td>Cobol Systems BV</td><td>Paid</td><td>€3,980.00</td></tr>
          <tr><td>INV-2025-0316</td><td>Orbital Mechanics GmbH</td><td>Overdue</td><td>€615.90</td></tr>
          <tr><td>INV-2025-0315</td><td>Bletchley Instruments</td><td>Paid</td><td>€48.50</td></tr>
        </tbody>
      </table>
    </section>
  </section>
  <section aria-labelledby="tile-stock-title">
    <h3 id="tile-stock-title">Stock alerts</h3>
    <ul>
      <li>Brass gear set: 6 left</li>
      <li>Punch card reader: 2 left</li>
    </ul>
    <p><a href="?view=stock&amp;filter=low">Reorder stock</a></p>
  </section>
  <section aria-labelledby="tile-shipments-title">
    <h3 id="tile-shipments-title">Shipments in transit</h3>
    <p><strong>23</strong> parcels, 2 delayed at customs</p>
    <p><a href="?view=shipments">Track shipments</a></p>
  </section>
  <section data-dashboard-tile="full" aria-labelledby="tile-tasks-title">
    <h3 id="tile-tasks-title">Tasks for today</h3>
    <p>Approve credit note CN-2025-0013, call Orbital Mechanics GmbH about invoice INV-2025-0316, and confirm the April price list.</p>
  </section>
</div>
```

## Attributes

| Attribute or value | Where | Effect |
| --- | --- | --- |
| `data-dashboard` | the wrapper (a `<div>`, or a `<ul>` of tiles) |  |
| `data-dashboard-tile="wide"` | a tile | two columns when they fit, else one |
| `data-dashboard-tile="full"` | a tile | the whole row |

Tiles: `<section aria-labelledby>` (or `<article>`, `<li>`) with a heading first.

### Elevation

Tiles use `--dui-elevation-raised` and its surface (level 1), whose 1px ring draws the edge, and a transparent border that forced colors mode paints in canvastext.

### Breakpoint

A wide tile spans two columns from 33.5rem of the wrapper's own inline size (two 16rem columns and the 1.5rem gap). A container query condition cannot read a custom property, so it is written as a length.

## Accessibility

- Tiles keep source order whatever the column count, so the reading and Tab order never jump (WCAG 1.3.2, 2.4.3).
- Figures in a tile are text, not only color (WCAG 1.4.1).
- Nothing scrolls sideways at 320px (WCAG 1.4.10); wrap a table in a tile in data-scroll="inline".

## Specifications

- [MDN CSS grid layout](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Grid_layout)
- [WCAG 1.4.10 Reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html)
- [MDN `auto-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/repeat#auto-fit)
- [MDN Container queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Containment/Container_queries)

## See also

- [Layouts](https://domestic-ui.odonckers.dev/layouts/index.md)
- Source: [`css/layout/dashboard.css`](https://github.com/odonckers/domestic-ui/blob/main/css/layout/dashboard.css), [`examples/layouts/dashboard.html`](https://github.com/odonckers/domestic-ui/blob/main/examples/layouts/dashboard.html)
- Demos: Dashboard view ([Plain HTML](https://github.com/odonckers/domestic-ui/blob/main/demos/vanilla/index.html), [React](https://github.com/odonckers/domestic-ui/blob/main/demos/react/src/DashboardPage.tsx), [Angular](https://github.com/odonckers/domestic-ui/tree/main/demos/angular/src/app/dashboard), [Astro](https://github.com/odonckers/domestic-ui/blob/main/demos/astro/src/pages/index.astro), [Vue](https://github.com/odonckers/domestic-ui/blob/main/demos/vue/src/DashboardPage.vue), [Svelte](https://github.com/odonckers/domestic-ui/blob/main/demos/svelte/src/DashboardPage.svelte))

## 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: No equivalent
- Vercel Geist: No equivalent
