# Stat tiles

> Row of headline KPI cards with a signed delta and up/down/good/bad framing.

- Group: Charts
- HTML page: https://design.ipmnx.com/charts/stat-tiles/
- Spec: https://design.ipmnx.com/design/#charts

## Usage

Load tokens.css, kit.css and behavior/charts.js (after behavior/util.js), then draw into an empty element. The chart is an inline SVG that re-themes with data-theme, dir and data-nx-product.

```js
NXCharts.renderStatTiles(el, dataset, a11y);
NXCharts.tableForStatTiles(el, dataset, a11y.tableSummary);
```

## Dataset

```json
{
  "tiles": [
    {
      "label": "Revenue",
      "value": "€48.2k",
      "delta": "+12.4%",
      "direction": "up"
    },
    {
      "label": "Active users",
      "value": "1,284",
      "delta": "+3.1%",
      "direction": "up"
    },
    {
      "label": "Churn",
      "value": "2.1%",
      "delta": "−0.4%",
      "direction": "good"
    }
  ]
}
```

## Accessibility

- Accessible name (role="img" with aria-label): Key metrics summary: revenue, active users, churn
- Data table summary (visually hidden table for screen readers): Revenue €48.2k (+12.4%); Active users 1,284 (+3.1%); Churn 2.1% (−0.4%, improving).

## Do / Don't

- Do: Use --nx-success (text-role, not -solid) for text-on-surface deltas. It clears contrast in both themes.
- Don't use colour alone for the direction. The sign (+/−) and word ("good"/"down") carry it too.

---

Source: registry.js (NX Design System)
