Components / data
StatGroup
Stats that belong together, framed so they read as one strip.
Summary
Stats that belong together, framed so they read as one strip.
| APG pattern | none |
| Built on | native elements |
| Status | self-tested |
| Since | 0.7.0 |
<StatGroup label="This week">
<Stat label="Built" value="7" />
<Stat label="Closed" value="5" />
<Stat label="Open" value="42" />
</StatGroup>
Anatomy
A <div data-se="stat-group"> holding stats as direct children. It has no parts of its own — the children are the anatomy, as in ButtonGroup.
_No named parts. The frame is the whole anatomy._
<div data-se="stat-group" role="group" aria-label="This week">
<div data-se="stat">…</div>
<div data-se="stat">…</div>
</div>
Properties
| Property | Values | Default | What it does |
|---|---|---|---|
label | string | none | Names the set and gives it role="group". Omitted, no role is written: a group with no name announces a boundary and says nothing about it, which costs a reader a stop and tells them nothing. |
children | React.ReactNode | none | The stats. They share one frame and one baseline, so a stat with a description beside one without still reads as a row. |
States
_None. Rest is the only condition it has._
Behavior
None. It wraps when the row runs out of room, one hairline between each stat and the next, and the hairlines follow the wrap.
Accessibility
A named group, or no group. The same rule as ButtonGroup: role="group" only with an accessible name, because a boundary without a name is a stop with no information.
The children do the reading. Each stat is its own label-and-value; the group adds its name before the first and nothing after the last.
Keyboard
None of its own. Nothing inside it is focusable.
Roles, states and properties
| Attribute | Set by |
|---|---|
aria-label | set at render |
role | always group, set at render |
Focus
Never takes focus.
Screen reader
Not recorded as verified. Stage 4 of the readiness ladder — driving each component with VoiceOver and NVDA — is unstarted across the package, and no component should claim otherwise until docs/journal/ records the session that did it.
Contrast and target size
npm run check:contrast audits every color pair this component uses across all four skins, light and dark, and fails the build on a shortfall. Two waivers are on the record in docs/audit/DEFERRED.md.
It sets no target size of its own; anything interactive inside it brings its own.
Tested
test/apg/stat-prose.test.jsxtest/browser/page-shell.spec.mjstest/browser/stat-prose.spec.mjs
Known gaps
_No upstream requirement is recorded as not applicable._
Appearance
By default a surface with a hairline border at the large radius, the raised shadow, and each stat padded inside it. Between stats, a hairline — drawn as a border on every stat's start and top edge, pulled one width outward and clipped by the frame, so a wrapped row keeps its dividers and no row starts with one. The stats are a grid: they share the width equally, a column is never narrower than two thirds of --se-col-min, and a lone stat in the last row takes one column, not the row.
form="tiles" draws the same stats as separate cards. The frame draws nothing: no border, no radius, no shadow. The grid gap (--se-space-4, the gap of data-se-layout="grid") runs between the cells, and each stat carries its own --se-border hairline and --se-radius-card, with no dividers and nothing pulled outward. A tile has no raised shadow, because it is drawn like a Card, which has none. The columns are the same two-thirds-of---se-col-min auto-fit.
| Token | Used for |
|---|---|
--se-border | border, border-block-start, border-inline-start |
--se-border-width | border, border-block-start, border-inline-start, margin-block-start, margin-inline-start |
--se-col-min | grid-template-columns |
--se-radius-card | border-radius |
--se-shadow-raised | box-shadow |
--se-space-4 | padding |
--se-space-5 | padding |
--se-surface | background |
Motion
None.
Content
The group's label is the period or the subject the stats share: This week, The board, Deploys. It is read once, before the stats, so it should not repeat what each label says.
Usage
Three to five stats. One is a Stat on its own; more than five is a table, and a DataTable sorts.
Same kind of number across the row. Counts beside counts. A percentage beside a duration beside a count asks the reader to switch units three times at a glance.
When not to use it. For values the reader compares down a column, DataTable. For a label and a value with no frame, Rows with its facts form.
Notes
Tiles are a form, not a component. A header's four "right now" numbers (the Daily Brief's clock, date, weather and morning-brief length) are the same stats in a different frame. A new component would repeat the anatomy, the grid and the two-thirds minimum for a frame; Rows already has two forms on one anatomy, and this follows it. Rejected: a gap prop, because the gap is the layout's and a page that wants another sets gap on the group. Rejected: keeping the raised shadow on each tile, because a row of shadowed tiles beside a Card reads as raised against it.
Named after ButtonGroup, and shaped like it. A frame around things that are one control, or one reading. The plural-container rule would have called it Stats; the group suffix was kept because the system already has two of them and a reader looking for a frame knows the word.
A grid with a two-thirds minimum, after the builder's adoption (15 Oct 2026). The first cut was a wrapping flex row with --se-col-min as the basis: at 1280 six stats wrapped four and two, five wrapped four and a lone fifth stretched across the row, and at 390 every stat took its own row where the hand-built strips fit two. The grid's auto-fit shares the width and gives a lone last cell one column. The minimum is two thirds of --se-col-min, not the half Rows' facts take: a stat's value is the heading step in the code face — 17 of 17 is about 115px at 2xl — plus the stat's inline padding, and half of the column minimum (112px) could not hold it; two thirds fits two on a phone and six in a row on a desk.
The divider is a border, not a gap. A gap between flex items disappears at the wrap and leaves the second row touching the first; a border only on + * draws one at the start of every row but the first. Every stat carries the border and the frame clips the outer ones. Recorded so the CSS is not simplified back.