Skip to component
GGamma

KPI card

A measurement with its change, a short history, and progress towards a target.

New
Membership overview
Paid members
1,463

+5.1%Improved.vs previous 30 days

Paid members rose from 1,310 to 1,463 over the last 30 days.
Target: 2,000 members73%
73%
Member churn
0.8%

−12.5%Improved.vs previous 30 days

Churn fell from 1.4% to 0.8% over the last 30 days.

A lower rate means more members stay.

Illustrative membership data.

Live previewUse keyboard to interact

Implementation

1import type { HTMLAttributes } from "react";2 3export type KpiCardProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {4  /** What the number measures. */5  label: string;6  /** A formatted measurement; null shows the unavailable state. */7  value: string | number | null;8  description?: string;9  /** Signed percentage change. Omit to hide the comparison; null means unavailable. */10  change?: number | null;11  changeLabel?: string;12  /** Falling costs or churn can be good news. */13  goodDirection?: "up" | "down" | "none";14  /** History ordered oldest first, with a text equivalent of its meaning. */15  sparkline?: { values: readonly number[]; description: string };16  /** Measured progress towards a positive target. */17  goal?: { value: number; max: number; label: string };18  unavailableLabel?: string;19};20 21/** A readable measurement with its change, history, and optional target. No client boundary is required. */22export function KpiCard({23  label,24  value,25  description,26  change,27  changeLabel = "vs previous period",28  goodDirection = "up",