4.2.0
Patterns

KPIStat

One point-in-time metric and what it changed by — a fixed shape, not a smaller Card, and not a number measured against a cap.

Default

A label and a number is the whole legal shape — everything else is optional. Values use tabular figures so a row of them lines up.

Replies
1,840
Deploys
128
12%vs prev.

Usage

import { KPIStat } from '@oceanic-hub/brand-system'

deltaPositive overrides the sign, and reaching for it is the point: the default reads the leading - and calls it bad, which is wrong for "fewer failed runs". Pass it wherever the arithmetic and the meaning disagree.

Oceanic-only, and shadcn's card in your table is a nearest relative at best, not a counterpart to pair against: Card is a generic bounded surface with a header, a footer and arbitrary content — upstream's own examples are a login form and a terms-of-service panel — and KPIStat is one fixed shape, a label over a number, that never grows a footer or an arbitrary child. A reader who wants a bounded surface for something other than a single metric reaches for Card instead; this component is not a smaller Card, it is a different job.

If the number is usage against a cap rather than a point-in-time reading — spend, seats, a quota — reach for SpendBar instead: it takes its capState from the product rather than inferring "near" or "over" from the two numbers at all, which is the same judgement deltaPositive lets you make here — except there it is the only way to say it, and here it is an override.

When down is good

deltaPositive overrides which fill the chip takes; it never touches the arrow. The median build's -8% still draws a DOWN arrow — the number fell, and an arrow's only job is to say which way — while the fill goes done, because deltaPositive says a fall is welcome here. Direction and semantics are two questions; pass deltaPositive wherever their answers disagree, and the glyph never lies about which way the number actually moved.

Failed runs
4
2vs prev.
Median build
3m 12s
8%vs prev.

With a trend

sparkline takes the raw series and colours the trace by the same polarity as the delta — done or stuck — and carries no label of its own, so a screen reader is not told the metric twice. cap adds a budget context line alongside it, e.g. "of €1,000".

Spend
€612
of €1,000

The dense scale, and a line of provenance

size="sm" sets the value in DM Mono at text-lg and the label in the eyebrow treatment, for a row of tiles sitting above a mono table — a proportional face aligns digits inside one string and never across two tiles, which is the whole reason the axis exists. note adds a line UNDER the value saying where the number came from; cap stays what it is, an allowance line beside the delta. Three tiles in a row keep their baselines because the value's box is the same at a given size whether the other lines are there or not.

Spend this week
€142.08what the subscription absorbed
€142 of €400
Cost per run
€0.42imputed, not billed
0.08vs prev.
Runs
1,284no sandbox cost recorded
Spend this week
€142.08what the subscription absorbed
Cost per run
€0.42imputed, not billed
Runs
1,284no sandbox cost recorded

A comparative caption

comparisonCaption names the window a delta compares against — a report showing a rolling 30 days should not have to fight the tile's own hardcoded "vs prev." Omit it and the tile renders exactly what it always has.

Cost per lead
€4.20
0.30vs. previous 30 days
Sessions
12,408
6.1%vs. same week last month

API Reference

See the KPIStat API page for every prop of every part, with types, defaults and the contract that pins them.

On this page