# StatGroup: the key figures at the top of an overview

StatGroup sets an overview's key figures in one row: the first in display size, the others a step quieter beside it, each with its change against the previous period and a small trend line. It lays itself out by its own width rather than the window's, so the same group reads four across on a wide screen and stacks on a phone.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/components/stat-group/

*Ridgeway Freight's reports for the last seven days on Wednesday 2 December 2026: the headline, then shipments in display size, on-time delivery against its goal, distance and fuel use, each with its change and trend.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/components/stat-group/

## What it is for, and what the preview shows

The few numbers someone opens an overview to see. The preview is the top of [Ridgeway Freight](https://meadowstack.com/examples/haulage-dispatch-planning/)'s reports for the last seven days as the demo shows them on Wednesday 2 December 2026, rebuilt from the kit with the demo's figures. It opens with the headline every overview has, a sentence with the numbers in it, then four figures: 648 shipments in display size, 94.0% delivered on time against a goal of 95%, 114,347 km driven and a fuel use of 28.5 l/100 km. Each carries its change against the previous seven days and a sparkline.

The colour of a change says whether it is good news, not which way it went. Fewer shipments and fewer kilometres are red, because more of both is what the business wants; lower fuel use is green; on-time delivery has not moved and says "no change" in grey. On a phone the display figure takes a row of its own and the other three wrap under it.

## The rules, and where they live

- **The manifest**: use it for a row of key figures on an overview, a `Stat` with a `Sparkline` each; not for a chart (`ColumnChart` in a `ChartCard`). It replaces "a grid of hand-built KPI cards".
- **AGENTS.md, Look and feel**: an overview opens with its `headline`, a sentence with numbers drawn as `Lead`, and it is required; figures are `StatGroup`, `hero` by default, with one display figure a screen at 40px at most.
- **docs/principles.md, Charts**: a figure's change is green or red by whether it is good news (`Delta` `goodWhen`), and "no change" when it rounds to zero.
- **docs/patterns.md, Data**: figures with a trend, the first one in display size, the others a step quieter, no frame; a change that says whether it is good news.
- **docs/decisions/0009-orientation.md**: the hero became the default, the boxed `framed` variant is deprecated, and above a list on a phone the group turns into a compact band so the list starts in the upper half of the screen.
- **scripts/check-markup.mjs**: `framed-stats` fails `<StatGroup variant="framed">` in an app.

## What AI coding tools write instead

A grid of hand-built KPI cards, as the manifest's `replaces` names it. What goes wrong:

- Four boxes with shadows, all the same size, so nothing says which number matters. The kit sets one figure in display size and the others beside it on the page, with no boxes.
- A rise is green and a fall is red, whatever the figure. Fuel use falling is good news: `goodWhen` makes the colour follow the meaning, and a change that rounds to zero says "no change" instead of a red "−0.0%".
- The cards break by the window's width, so a panel opened beside the page squeezes four cards into slivers. The kit's group follows its own width: four across needs 48rem, about 192px a figure.
- The figures carry no trend, so a bad day cannot be told from a slide all week. The kit's `Stat` takes a `Sparkline` beside or under its value, and leaves it out on a phone.
- Nothing above the cards says what they add up to. The kit's overview opens with the `Lead` sentence first: 648 shipments in seven days, below the goal.

## How to use it

- `StatGroup` holds `Stat` children; `variant` is `hero` by default, or `open` for figures with air between them and no frame.
- `Stat`: `label`, `value`, `hint` (usually a `Delta`) and `chart` (a `Sparkline`); `hero` makes another figure the display one.
- `Delta`: `value` (0.034 is +3.4%), `kind` (`percent`, `points` for a rate, `absolute` with a `unit`), `goodWhen` (`up` or `down`) and `suffix`, what it is measured against.
- `Sparkline`: the period's `values`, drawn to their own range.
- `Lead` above the group carries the overview's headline.

## Its entry in the manifest

*The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.*

| Manifest field | StatGroup |
| --- | --- |
| What it is | Frame for Stats. Cells draw a hairline on their top and left edge; the inner grid is shifted up and left by 1px and the frame clips it, so only the lines between cells remain, in any column count. Columns follow the frame's own width (container query), not the window: a StatGroup in a side column or a half-width story stays two per row. Four across needs 48rem (192px a cell), the width "4 573 473 Kč" at 24px needs. Hero is the default since decision 0009 (3 Nov 2026): the first figure in display size, no frame. It takes its own row below 48rem (a 30px figure does not fit half of a 390px phone), and with five or more figures it keeps that row at every width while the rest wrap two, three or four across (a 1.4fr column beside four was 110px). One figure is one column. In an index (above a list, `useScreenInset`) the group is a compact band where it is narrower than 36rem (a phone, decision 0009's phone rule, 4 Nov 2026): every figure two across at 20px, the hints left out, so the list starts in the upper half of a 390 × 844 screen. Stonebridge Zakázky put four figures, 270px, above its list; the band is 108px. One line for the labels, one baseline for the values (Bob, 1 Dec 2026: Ridgeway's Reports and Martin's media kit had their labels at 257, 267 and 281px, because the cells sat on their bottom edge and a taller hero figure, a hint or a sparkline that wrapped lifted their labels). Each Stat is a subgrid of the group's rows, label, value and hint, so labels share a line, values share a baseline whatever their size, and hints share a line under the tallest value. The display figure is 40px at most (32px on a phone) and there is one a screen: on a Screen a second hero group draws its figures at the regular size (`useHeroClaim`). |
| Use it for | A row of key figures on an overview (Stat, with a Sparkline). |
| Not for | For a chart (ColumnChart in a ChartCard) |
| It replaces | A grid of hand-built KPI cards |
| Screen types | Overview; Record |
| Import | `import { StatGroup, Stat, Sparkline } from "@meadowstack-studio/kit";` |

Read from the kit's component manifest when the site was built (126 components, packages/kit/src/components.json); the same entry answers an AI coding tool through the kit's MCP server.

## Where it runs in the example apps

*The example apps whose code renders a StatGroup, and the modules it sits in.*

| Example app | Modules that render it |
| --- | --- |
| [An app for a packaging and print company](https://meadowstack.com/examples/packaging-print-production/) | Jobs, Print file editor, Cutting dies, Colour |
| [An app for a studio or agency](https://meadowstack.com/examples/agency-capacity-planning/) | Tasks, Finance |
| [An app for a haulage company](https://meadowstack.com/examples/haulage-dispatch-planning/) | Freight, Costs, Reports |
| [An app for a roastery with an online shop](https://meadowstack.com/examples/coffee-roastery-production/) | Roasting, Green coffee, Shop, Wholesale, Scenarios |
| [An app for a sports club](https://meadowstack.com/examples/sports-club-court-bookings/) | Front desk, Courts, Club, Coaching, Rentals |
| [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) | Sites, Machines, Site diary, Drawings, Budget |
| [An app for an accounting office](https://meadowstack.com/examples/accounting-office-documents/) | Bookkeeping, Official mail, Invoicing |
| [An app for restaurants and venues](https://meadowstack.com/examples/restaurant-staff-rota/) | Shifts, Kitchen, Food safety |
| [An app for one person](https://meadowstack.com/examples/personal-app-for-a-creator/) | Content, Money, Training |

Read from the demo's source when the site was built: 9 of 9 example apps render <StatGroup>, in the modules named here as each app's sidebar names them.

## How the demo calls it

*Ridgeway's reports: one Stat per figure, the label with its goal, the value rolling to its new number, the change as the hint and the trend as a sparkline.*

From `apps/demo/src/modules/analytics/pages/analytics.tsx` in the Meadowstack repository:

```tsx
<StatGroup key={index}>
  {widget.items.map((kpi) => {
    const base = formatter(kpi.format);
    const format = (value: number) => (kpi.unit ? `${base(value)} ${kpi.unit}` : base(value));
    return (
      <Stat
        key={kpi.label}
        label={<KpiLabel kpi={kpi} />}
        value={
          <AnimatedNumber
            value={
              kpi.format === "percent"
                ? Math.round(kpi.value * 1000) / 1000
                : kpi.format === "decimal"
                  ? Math.round(kpi.value * 10) / 10
                  : Math.round(kpi.value)
            }
            format={format}
          />
        }
        hint={<KpiHint kpi={kpi} />}
        chart={kpi.trend ? <Sparkline values={kpi.trend} /> : undefined}
      />
    );
  })}
</StatGroup>
```

## Questions

### Which figure is shown large?

The first Stat in a hero group, unless another one says hero. A screen has one display figure, at most 40px, and the rest sit beside it a step quieter.

### How does the change know whether it is good news?

Delta takes goodWhen, up or down. Shipments falling is red, fuel use falling is green, and a change that rounds to zero at one decimal is a grey no change.

### What happens on a phone?

The group follows its own width. Below 48rem the display figure takes its own row, because a 30px figure does not fit half of a 390px screen, and the others wrap under it. Above a list on a phone the group becomes a compact band of two figures a row.

### Can the figures sit in boxes?

No. The boxed framed variant is deprecated and the markup check fails it in an app. Use the hero, or open for numbers that sit on the page with air between them.

## Related

- [BarList: a ranking you read from the top](https://meadowstack.com/components/bar-list/) (Components)
- [Heatmap: when the work happens, by weekday and hour](https://meadowstack.com/components/heatmap/) (Components)
- [A fleet cost report that ranks every truck](https://meadowstack.com/screens/fleet-costs/) (Screens)
- [A weekly timesheet for an agency](https://meadowstack.com/screens/timesheet/) (Screens)
- [The overview screen](https://meadowstack.com/patterns/overview/) (Patterns)
- [A change order that shows its price before anyone approves it](https://meadowstack.com/screens/change-order-form/) (Screens)
