Skip to content
Component installs need the registry setup— the Base UI shadcn project, the @vegastack namespace and the Cloudflare Access service token.
VegaStack Design

Stat

A labelled value block — muted label over a value, an honest faint empty state, and an optional delta line. Two scales.

Status
stable
Since
0.3.0
Accessibility pattern
label and value pair

Last updated

Estimated ARR
$1M–$10M
Employee range
11–50
Connection strength
No connection

Install

Add Stat from the VegaStack registry. The CLI verifies the item's integrity hash before writing it.

pnpm dlx shadcn@latest add @vegastack/stat

Usage

import {
  Stat,
  StatDelta,
  StatEmpty,
  StatLabel,
  StatValue,
} from "@/components/ui/stat";

<Stat>
  <StatLabel>Estimated ARR</StatLabel>
  <StatValue>$1M–$10M</StatValue>
</Stat>;

Dashboard tiles

size="lg" scales the value to the type-scale cap (24px, tabular) for stat tiles; add a StatDelta with intent="up" | "down" | "flat" — the sign/arrow in the copy carries the meaning, color is never the only signal.

Active companies
1,284
↑ 12% this month
Churned
17
↓ 3 vs last month
Open deals
62
No change

Honest empties

When there is no value, render StatEmpty ("No connection", "No team") in the faint placeholder register — never a dash or a zero that would read as data. This mirrors the system-wide inline-empty tier (EmptyValue).

Anatomy

Stat is a compound component. Every exported part, with the data-slot it renders (generated from the canonical source):

Stat — data-slot="stat"
StatDelta — data-slot="stat-delta"
StatEmpty — data-slot="stat-empty"
StatLabel — data-slot="stat-label"
StatValue — data-slot="stat-value"

Examples

The default scale suits record highlights; the tile preview exercises the large value scale and all three delta intents.

Estimated ARR
$1M–$10M
Employee range
11–50
Connection strength
No connection
Active companies
1,284
↑ 12% this month
Churned
17
↓ 3 vs last month
Open deals
62
No change

API Reference

Stat

PropTypeDefaultDescription
size"lg" | "md"'md'Scale — default for facts/highlights rows, lg for dashboard tiles.

Data attributes and CSS variables on Stat

AttributeValues
data-sizemirrors a prop or state value
data-slot"stat"

StatLabel, StatValue, and StatEmpty

These structural parts accept native <div> props and forward their refs to their respective elements.

StatDelta

PropTypeDefaultDescription
intent"down" | "flat" | "up"'flat'Direction of the change — up reads success, down reads destructive, flat stays muted. Pair the copy with a sign/arrow; color is never the only signal.

Data attributes and CSS variables on StatDelta

AttributeValues
data-intentmirrors a prop or state value
data-slot"stat-delta"

Accessibility

  • Keep the label visible so the value has an adjacent human-readable name.
  • Delta copy carries direction with words or a sign; color is supplementary.
  • Use StatEmpty for missing data instead of a dash or a misleading numeric zero.
  • Tabular numerals keep changing values aligned without changing their spoken representation.
ContractStates tested
Behaviourdefault, empty, error, success
Accessibilitynative-or-base-ui-semantics, browser-accessibility-test
Visualdefault, error, success, empty

Do / Don't

Do
Pair every value with a concise label and write delta text that remains meaningful without color.
Don't
Animate rapidly changing metrics in a live region or substitute zero for unknown data.

On this page