1. Documentation
  2. Data display
  3. Stat
ReadmenpmGitHub
  • Introduction
  • Installation
  • Theming
  • Icons
  • Accordion
  • Card
  • Scroll Area
  • Separator
  • Sidebar
  • Field
  • Label
  • Input
  • Textarea
  • Number Field
  • OTP Field
  • Select
  • Combobox
  • Checkbox
  • Radio
  • Switch
  • Slider
  • Toggle
  • Calendar
  • Date Picker
  • File Upload
  • Button
  • Copy Button
  • Dropdown
  • Command
  • Tabs
  • Breadcrumb
  • Pagination
  • Tree
  • Table
  • Data Table
  • Stat
  • Timeline
  • Avatar
  • Status Bar
  • Badge
  • Meter
  • Empty
  • Skeleton
  • Spinner
  • Toast
  • Dialog
  • Sheet
  • Popover
  • Tooltip
  • Text
  • Kbd
  • Code Block
  • Utilities
  • Design rules

Stat

One number, its name, and how it moved.

Loading documentation…

Data Table< PreviousTimelineNext >

Powered by heyo

On this page

UsageDeltasBordered, and with a chartGroupsPropertiesStatStat.Group
Requests
142,318▲12.4%
vs last week
Error rate
0.42%▼18.2%
p95 latency
84ms▲4.1%
<Stat.Group columns={3}><Stat label="Requests" value="142,318" delta={12.4} deltaLabel="vs last week" /><Stat label="Error rate" value="0.42" unit="%" delta={-18.2} deltaGood={false} /><Stat label="p95 latency" value="84" unit="ms" delta={4.1} deltaGood={false} /></Stat.Group>

The value is the only large type in the component and the only thing at full contrast. A stat where the label competes with the number is a stat nobody reads at a glance.

Usage

tsx
import { Stat } from "@heyo-sh/heyo-ui";<Stat  label="Requests"  value="142,318"  delta={12.4}  deltaLabel="vs last week"/>;

Deltas

delta is a number, not a string: -4.2 renders as "−4.2%" and the sign picks the colour. deltaGood={false} flips that mapping — for latency, error rate or spend, where up is exactly what you did not want.

Signups
1,204▲8.3%
Churn
2.1%▲6.9%
Spend
412EUR▼11%
vs last month
<Stat label="Signups" value="1,204" delta={8.3} /><Stat label="Churn" value="2.1" unit="%" delta={6.9} deltaGood={false} /><Stat label="Spend" value="412" unit="EUR" delta={-11} deltaGood={false} deltaLabel="vs last month" />

Bordered, and with a chart

bordered adds the hairline and the surface. It is off by default so a stat can sit inside a Card without drawing a second box. chart is the slot under the numbers — a sparkline, a Meter, a StatusBar.

Uptime
99.98%
<Statborderedicon={IconActivity}label="Uptime"value="99.98"unit="%"chart={<StatusBar size="sm" ticks={ticks} />}/>

Groups

Stat.Group separates stats with hairlines rather than gaps — the dashboard header pattern. Dividers instead of cards, so the row reads as one band.

A stat is not a metric chart

It answers "what is it now, and which way is it going". For the shape over time, put a sparkline in chart.

Properties

Stat

labelReactNoderequired

What the number is.

valueReactNoderequired

The number itself — the only large type in the component.

unitReactNodeoptional

A unit or qualifier printed after the value, smaller and muted.

deltanumberoptional

Change against the previous period, as a number. The sign decides the colour.

deltaGoodbooleanoptional

Whether a rise is good. It defaults to true; pass false for latency, errors or spend.

deltaUnitstringoptional

The suffix on the delta. It defaults to "%".

deltaLabelReactNodeoptional

What the delta is measured against, for example "vs last week".

iconIconLikeoptional

A small glyph beside the label.

chartReactNodeoptional

The slot under the numbers.

borderedbooleanoptional

Adds the hairline and surface. Off by default.

Stat.Group

columns2 | 3 | 4optional

Columns on a wide screen. It defaults to 3.