Content
Stat
One key number with its label and optional context.
- Experimental
- No keyboard interaction
- Screen reader not tested yet
Playground
Change the props and the surface. The controls come from the documented props; the surfaces are the real modes.
- open requests
- 12
<Stat value="12" label="open requests" context="Example values" />Usage
When to use
Use a stat for a key number that people should see at a glance: counts, durations, rates on an overview page.
When not to use
- For numbers people compare across rows: use Table.
- As decoration: a stat without a real source doesn't belong on the page.
How it works
The value is shown first and large, the label below it, but both are a description list, so screen readers read “label: value”. lg uses display type for a few headline numbers; md uses heading type for rows of many. context adds period, comparison or source in small type.
Content guidelines
Only real numbers, with their period and source in the context. Keep the value short; long units such as “days” belong in the label, so the number doesn't wrap.
Do and don’t
Do
- Only real numbers. Say the period and the source in the context.
Don’t
- Don't round so far that the number becomes a claim; don't use Stat for decoration.
Anatomy
The parts of the component and what each one does, as in the playground above.
- valueDisplay type (lg) or heading type (md).
- labelSmall text in text.secondary, below the value.
- captionOptional context in text-meta.
Examples
Type-checked, and the same code goes into the AI manifest. Import: import { Stat } from "@/ds";
Headline numbers
- open requests
- 12
- days average reply time
- 3.2
- answered within a week
- 87 %
Compact
- drafts
- 4
- in review
- 2
Props
Checked against the component's TypeScript type on every build.
| Name | Type | Default | Description |
|---|---|---|---|
| value (required) | string | number | – | The number, formatted for reading. |
| label (required) | string | – | What the number counts. |
| context | ReactNode | – | Period, comparison or source. |
| size | "md" | "lg" | "lg" | lg for a few headline numbers, md for rows of many. |
Tokens used
Derived from the utility classes in the component's source. Copy a class with one click.
| Token | Tier | Value | Utility |
|---|---|---|---|
| display.tracking | component | -0.035em | |
| display.weight | component | 800 | |
| spacing.1 | semantic | 4px | |
| text.primary | semantic | #0A0A0B | |
| text.secondary | semantic | #555555 | |
| type.display-lg.size | semantic | clamp(40px, 6vw, 72px) | |
| type.heading.size | semantic | clamp(24px, 2.5vw, 32px) | |
| type.meta.size | semantic | 13px | |
| type.small.size | semantic | 14px | |
| weight.semibold | semantic | 600 |
Accessibility
What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
| Check | How | Status |
|---|---|---|
| axe-core rules | Automated on every npm run check, at desktop and mobile width | Runs on every build |
| Keyboard | Automated Playwright test (scripts/keyboard.mjs) | Not applicable |
| Screen reader | Manual | Not tested yet |
Semantics and focus
- A dl: the label is read before the value, although the value is shown first.