StatTile
One headline figure with a caption over it.
Overview
A single number a person should see first: a total, a date, a balance.
Figure
Do
Left over
R 4 250
after all bills
Debt-free
Mar 2029
import { CardGrid, StatTile } from "@hackcove/ui";
<CardGrid columns={2}>
<StatTile label="Left over" value="R 4 250" hint="after all bills" />
<StatTile label="Debt-free" value="Mar 2029" />
</CardGrid>R 4 250, Mar 2029, 12%.Don't
Left over
4250.5
Savings
1250000
import { CardGrid, StatTile } from "@hackcove/ui";
<CardGrid columns={2}>
<StatTile label="Left over" value={4250.5} />
<StatTile label="Savings" value={1250000} />
</CardGrid>Tone
Do
Left over
+R 4 250
surplus
Total interest
−R 12 400
shortfall
import { CardGrid, StatTile } from "@hackcove/ui";
<CardGrid columns={2}>
<StatTile label="Left over" value="+R 4 250" hint="surplus" tone="positive" accent />
<StatTile label="Total interest" value="−R 12 400" hint="shortfall" tone="negative" accent />
</CardGrid>tone colours the value, and a sign and a hint say what the colour means.Don't
Left over
R 4 250
Total interest
R 12 400
import { CardGrid, StatTile } from "@hackcove/ui";
<CardGrid columns={2}>
<StatTile label="Left over" value="R 4 250" tone="positive" accent />
<StatTile label="Total interest" value="R 12 400" tone="negative" accent />
</CardGrid>Usage
- Pass
valuealready formatted, with its unit and grouping (R 4 250,Mar 2029); the tile does not format. labelnames the figure;hintis one short line under it.toneisneutral,positiveornegative. A tone colours the value, so give it a sign or ahintthat says the same;accentadds a bar in the same tone across the top.- Lay several tiles out in a
CardGrid. A tile is not a button or a link.
Accessibility
- A StatTile is plain text in a
<div>: the caption, the value and the hint are read in that order. - The
accentbar is decoration and hidden from assistive tech. - Colour alone never carries the tone; a sign or the hint says it.
API
StatTile
One headline figure: an uppercase caption over a large tabular-nums value, with an optional hint line beneath. tone colours the value; accent adds a bar across the top edge in the same tone. Pass the value already formatted.
accent- Type
boolean- Default
false
hint- Type
ReactNode
label required- Type
ReactNode
toneDefaults to "neutral".
- Type
"positive" | "neutral" | "negative"- Default
neutral
value required- Type
ReactNode