Adres
Playground/ docs
Patterns

KPI Card

Four sizes, compact groups, threshold states, icon/description/loading, and clickable cards for dashboard metrics.

KPI Card

Sizes — mini · sm · md · lg

Four sizes scale the value, suffix, trend, icon, and card padding together. Use mini for the densest layouts — a smaller value sitting tight to its label (half the gap), sm for dense dashboards with many metrics on screen, md as the default, and lg when the KPI row is the page's hero. Note: the trend value uses raw text-* font-bold rather than a t-h* token so the semantic text-success / text-destructive color isn't overridden by the token's text-foreground-strong.

mini

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

sm

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

md

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

lg

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

Compact group — merged-border block

Wrap KpiCards in <KpiCardGroup compact> to merge them into a single visual block — children drop their individual rounding and shadow and their borders overlap by 1px so the seam reads as one line. Horizontal on desktop, stacks vertically on mobile. Pairs with any size, shown below at all three.

mini

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

sm

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

md

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

lg

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

Compact table — two rows (4 + 2)

<KpiCardGroup compact columns={4}> renders one seamless bordered table with 1px hairline dividers. The first row is four cells; the second row's two cards use className="sm:col-span-2" to each span two columns, so it reads as two wider cells — all attached as a single block.

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

Certificates

56

Avg. session

24 min

5%

Satisfaction

4.6/5

2%

States — positive · negative · small · empty

Pass change as a signed percentage: positive renders a success pill with an up-arrow, negative renders destructive with a down-arrow, and 0 or undefined renders no delta at all (zero isn't a trend). When the numeric value resolves to 0 and no change is provided, the card shows a quiet "No data yet" empty state instead.

Active listings

142

12%

Avg time on market

36 days

8%

Conversion

3.2%

2%

New leads

0

No data yet

Icon · description · loading

Pass an icon to add a muted topic glyph in the top-end corner (useful when several KPIs share a row and the eye needs an extra cue). description renders a small context line under the value — most often the comparison window the change refers to. While loading is true the card swaps to skeleton placeholders without changing its height, so the dashboard layout doesn't jump on fetch.

Revenue

2.4M AED

18%

vs last 30 days

Active students

127

12%

vs previous cohort

Completion rate

73%

3%

vs last quarter

Clickable

Pass an onClick handler and the card automatically becomes interactive — resting at shadow-xs and lifting to shadow-md on hover, with a pointer cursor. No extra prop required.

Revenue

2.4M AED

18%

Active students

127

12%

Completion rate

73%

3%

New leads

0

No data yet