Skip to content

Dashboard Stat Cards for React

Dashboard stat cards for React are glass KPI cards whose numbers count up, sparklines draw in and periods switch with a sliding pill.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/dashboard-stats.json

Overview

Revenue

Up 12.4% vs previous period

$48,250

Active users

Up 6.1% vs previous period

3,842

Conversion

Down 0.6% vs previous period

4.8%

New signups

Up 18.9% vs previous period

612

Stat cards

Overview

Revenue

Up 12.4% vs previous period

$48,250

Active users

Up 6.1% vs previous period

3,842

Conversion

Down 0.6% vs previous period

4.8%

New signups

Up 18.9% vs previous period

612

Files to copy

9 folders · 17 files · 4 packages
From theme/src/
  • blocks/{dashboard-stats.tsx, icons.tsx}
  • components/charts/{chart-utils.ts, sparkline.tsx}
  • components/glass-card/
  • components/status-icons/
  • components/tabs/
  • hooks/{use-controllable.ts, use-direction.ts, use-intersection.ts, use-latest.ts, use-media-query.ts, use-preferences.ts}
  • motion/{light-follower.ts, tokens.ts}
  • lib/{cn.ts, form.ts, heading.ts, math.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/dashboard-stats.jsonRegistry item: dashboard-stats. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Your numbers, periods and currency

The keys of data become the period tabs (“4w” reads as “Last 4 weeks”). goodWhen: “down” turns a falling churn rate green; currency and locale format every figure.

Team health

Revenue

Up 6,2 % vs previous period

18.400 €

Churn

Down 0,4 % vs previous period

2,1 %

Props

PropTypeDefaultDescription
dataRecord<string, Stat[]>demoDataStats per period (Record<string, Stat[]>). Keys become the period tabs. Default: built-in demo numbers for 7d, 30d and 90d. The default is sample content for demos and prototypes: pass your own in production.
titlestring"Overview"The section heading (string, default "Overview"); it also names the section for screen readers.
headingLevelHeadingLevelOption2Level of the section heading (1 to 5, default 2); the stat labels sit one level below. "none" renders paragraphs with no heading role (for an example).
currencystring"USD"ISO 4217 currency for "currency" stats (string, default "USD").
localestring"en-US"BCP 47 locale used to format every number (string, default "en-US").
labelsPartial<DashboardStatsLabels>defaultDashboardStatsLabelsEvery other string, for translation: labels={{ period: "…" }}; omitted keys keep the English of defaultDashboardStatsLabels. All 4 keys of DashboardStatsLabels are listed in the key table under the props table.
classNamestringNoneAdds extra classes to the outer <section> (string).
Stat{ label, value, change, trend, format?, goodWhen? }Nonechange is a % vs the previous period; goodWhen: "down" suits churn or response time.
DashboardStatsLabels keys and English defaults (4)
Pass any key in labels; the rest keep the defaults of defaultDashboardStatsLabels.
KeyEnglish default
periodPeriod
periodName(key) => { const match = /^(\d+)\s*([dwmy])$/i.exec(key); if (!match) return key; const n = Number(match[1]...
change(direction, amount) => `${direction === "up" ? "Up" : "Down"} ${amount} vs previous period`
trend(label) => `${label} trend`

Keyboard

KeysAction
TabReach the period tabs.
←/→Previous / next period.
Home/EndFirst / last period.

Accessibility

  • A labeled <section>; each period tab shows “7d” and is named “7d, Last 7 days”, so the visible text is part of the name.
  • The change badge reads “Up 12.4% vs previous period”, and the animated count is hidden from screen readers, which get the final figure at once.
  • Each sparkline has a text name.

All exports on this page

  • DashboardStats — A row of KPI cards (value, change badge, sparkline) with a period switcher.
  • defaultDashboardStatsLabels — The English DashboardStatsLabels used when labels is omitted; a partial labels prop is merged over it.

When to use the dashboard stat cards

  • Use DashboardStats as a row of KPI cards with sparklines at the top of an analytics overview, where four cards for revenue, active users, conversion and signups each show a value, change badge and sparkline.
  • Use it for a product or ops dashboard with a 7d, 30d and 90d switcher, passing one Stat array per period key in the data prop and letting the keys become tabs.
  • Use it for metrics where lower is better, such as churn or response time, by setting goodWhen to "down" so a falling number reads as good news.
  • Skip it when you need to explore one metric in depth with axes, tooltips and a legend; a full chart component fits better than a KPI card with a sparkline.
  • Pair it with Sparkline for custom trend visuals, Tabs if you want a second switcher elsewhere, and the chart components lower on the page for the detail behind each figure.

Frequently asked questions

20 blocks pages in all: browse them on All blocks.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .