Stat

A key number with its change, the period it's compared with and an optional trend.

Recurring revenue

$296.8K

Up 2.5% vs October, an improvement

Weekly signups

859

Up 4.8% vs last week, an improvement

p95 latency

236 ms

Down 12% vs yesterday, an improvement

Open tickets

254

Up 14 vs last week, a decline

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/stat

Usage

import { Stat } from "./ui/uicontext/components/charts/Stat.ts"
export const RevenueStat = <M>(h: Html.H<M>, mrr: number, change: number, trend: ReadonlyArray<number>) =>	Stat(h, {		label: "Recurring revenue",		value: mrr,		format: { style: "currency", currency: "USD" },		change: { value: change, period: "vs last month" },		trend,	})

Examples

States

Loading, empty, unchanged, linked, and a very large number.

Net revenue retention

Refunds this month

—

No change vs last month

Uptime, last 30 days

99.98%

No change vs last 30 days

API requests served this year across every region

48.2B

Up 184% vs last year, an improvement

API reference

Options

Stat options
NameTypeDescription
labelrequiredstring—
valuerequirednumber | nullNull: no value yet, shown as "—"
formatChartFormat—
changeStatChange—
good"up" | "down" | "neither"Which way is good: up (revenue, the default), down (latency, churn) or neither
trendReadonlyArray<number | null>Recent values, oldest first, drawn as a sparkline
hrefstringA link to the full report: the label becomes it
loadingbooleanShows a placeholder in the value's place
localestring—
styleStyle—

Accessibility

  • The change is read in words, with its direction and whether that's good: “Up 8.4% vs October, an improvement”. Color only repeats it.

Source