component
Stat
One figure that matters, with what it is and how it moved. A label, the number in title type, and a line in green or red.
PositiveNegativeNeutralimport { Stat } from 'rost/components/stat/Stat'
<Stat label="Paid this month" value="€12,480" delta="Up 12% on October" tone="positive" /> src/components/stat/Stat.tsx
import type { HTMLAttributes, ReactNode } from 'react'
import './stat.css'
export interface StatProps extends HTMLAttributes<HTMLDivElement> {
/** What the figure is. */
readonly label: ReactNode
/** The figure, formatted. */
readonly value: ReactNode
/** How it moved, in words. */
readonly delta?: ReactNode
/** The delta's colour: good news is positive, whichever way the number went. */
readonly tone?: 'positive' | 'negative' | 'neutral'
}
const b = 'rost-stat'
/** One figure that matters. Built from contracts/stat.contract.yaml. */
export function Stat({ label, value, delta, tone = 'neutral', className, ...rest }: StatProps) {
return (
<div className={[b, `${b}--tone-${tone}`, className].filter(Boolean).join(' ')} {...rest}>
<span className={`${b}__label`}>{label}</span>
<span className={`${b}__value`}>{value}</span>
{delta != null && <span className={`${b}__delta`}>{delta}</span>}
</div>
)
}
The source for everything on this page: contracts/stat.contract.yaml (opens in a new tab). The CSS, the docs and the checks in each app are built from it.
# yaml-language-server: $schema=../schema/component-contract.schema.json
schemaVersion: 2
id: stat
name: Stat
kind: component
status: review
summary: "One figure that matters, with what it is and how it moved. A label, the number in title type, and a line in green or red."
category: display
related: [ card, badge, progress ]
source:
tool: figma
fileKey: 1Zy0wiWKXQAvsfDBX3KR0d
nodeId: "743:40"
url: https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=743-40
extractedAt: "2026-11-16"
extractedBy: hand
frozenAt: "2026-11-16"
props:
label: { type: slot, required: true, notes: "What the figure is: Paid this month." }
value: { type: slot, required: true, notes: "The figure, formatted: €12,480." }
delta: { type: slot, notes: "How it moved, in words: Up 12% on October." }
tone:
type: enum
values: [ positive, negative, neutral ]
default: neutral
notes: "The delta's colour. Good news is `positive` whichever way the number went: costs going down is positive."
elements:
root:
notes: "A column, 4px between its lines. It sits in a Card or a row of them."
styles:
display: { value: flex, assert: false }
flex-direction: { value: column, assert: false }
gap: { token: spacing/gap/2xsmall, value: 4px }
label:
styles:
font-family: { token: font-family/base, value: "'General Sans Variable'" }
font-weight: { token: typography/label/font-weight/regular, value: "400" }
font-size: { token: typography/label/font-size, value: 12px }
line-height: { token: typography/label/line-height, value: 14px }
letter-spacing: { token: typography/label/letter-spacing, value: 0px }
color: { token: stat/label, value: "#d3d9d5" }
value:
styles:
font-family: { token: font-family/base, value: "'General Sans Variable'" }
font-weight: { token: typography/title/font-weight/medium, value: "500" }
font-size: { token: typography/title/font-size, value: 24px }
line-height: { token: typography/title/line-height, value: 32px }
letter-spacing: { token: typography/title/letter-spacing, value: 0px }
color: { token: stat/value, value: "#ededed" }
delta:
notes: "Label type, medium weight, in the tone's colour. The words say which way, so the colour isn't the only sign."
styles:
font-family: { token: font-family/base, value: "'General Sans Variable'" }
font-weight: { token: typography/label/font-weight/medium, value: "500" }
font-size: { token: typography/label/font-size, value: 12px }
line-height: { token: typography/label/line-height, value: 14px }
letter-spacing: { token: typography/label/letter-spacing, value: 0px }
variants:
- when: { tone: positive }
figmaNode: "743:27"
elements:
delta:
color: { token: stat/delta/positive, value: "#00d669" }
- when: { tone: negative }
figmaNode: "743:31"
elements:
delta:
color: { token: stat/delta/negative, value: "#f2705f" }
- when: { tone: neutral }
figmaNode: "743:35"
elements:
delta:
color: { token: stat/delta/neutral, value: "#999999" }
guidance:
status: proposed
use:
- title: A number to watch
text: "The few figures a dashboard is for: paid this month, tax set aside, outstanding."
show: tone=positive
avoid:
- title: Many numbers
text: "A dozen figures to compare. That's **Table**."
behaviour: "Three lines: what, how much, how it moved. The delta takes the tone's colour; its words carry the meaning."
accessibility:
element: "A `<div>`. Put it in a list (`<ul>`) when there are several, so they're counted."
name: "The label, read before the figure."
colour: "The delta is 9:1 green or 6:1 red on the dark page, and its words say up or down."
content: "Label in sentence case, figure formatted for the reader, delta as a sentence: Up 12% on October."
Install
npx github:Runceanu/rost add stat It lands in src/rost/stat/, with what it needs and its contract. Install has the rest.
When to use
A number to watch
The few figures a dashboard is for: paid this month, tax set aside, outstanding.
When not to use
Many numbers
A dozen figures to compare. That's Table.
Behaviour
Three lines: what, how much, how it moved. The delta takes the tone's colour; its words carry the meaning.
Accessibility
- Element
A
<div>. Put it in a list (<ul>) when there are several, so they're counted. - Name
The label, read before the figure.
- Colour
The delta is 9:1 green or 6:1 red on the dark page, and its words say up or down.
Content
Label in sentence case, figure formatted for the reader, delta as a sentence: Up 12% on October.
Props
| Prop | Type | Values | Default |
|---|---|---|---|
label | slot | | |
value | slot | | |
delta | slot | | |
tone | enum | positive · negative · neutral | neutral |
Values
Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.
Never changes
root
-
gap4pxspacing/gap/2xsmall
displayflex · flex-directioncolumn
label
-
font-family'General Sans Variable'font-family/base -
font-weight400typography/label/font-weight/regular -
font-size12pxtypography/label/font-size -
line-height14pxtypography/label/line-height -
letter-spacing0pxtypography/label/letter-spacing -
color#d3d9d5stat/label
value
-
font-family'General Sans Variable'font-family/base -
font-weight500typography/title/font-weight/medium -
font-size24pxtypography/title/font-size -
line-height32pxtypography/title/line-height -
letter-spacing0pxtypography/title/letter-spacing -
color#edededstat/value
delta
-
font-family'General Sans Variable'font-family/base -
font-weight500typography/label/font-weight/medium -
font-size12pxtypography/label/font-size -
line-height14pxtypography/label/line-height -
letter-spacing0pxtypography/label/letter-spacing
Changes by variant
3 variants. Each table is what one thing changes with: a column per tone, a row per property. Where every row starts with the same token path, it's written once, under the property.
Follows tone
| Property | Positive | Negative | Neutral |
|---|---|---|---|
delta.colorstat/delta/… | positive #00d669 | negative #f2705f | neutral #999999 |