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.jsonOverview
Revenue
Up 12.4% vs previous period$48,250
Active users
Up 6.1% vs previous period3,842
Conversion
Down 0.6% vs previous period4.8%
New signups
Up 18.9% vs previous period612
DashboardStatsdefaultDashboardStatsLabels
Stat cards
Overview
Revenue
Up 12.4% vs previous period$48,250
Active users
Up 6.1% vs previous period3,842
Conversion
Down 0.6% vs previous period4.8%
New signups
Up 18.9% vs previous period612
import { DashboardStats } from "@/components/sheenui/blocks/dashboard-stats";
// Package build (after the first npm release, or a packed tarball): import { DashboardStats } from "@sheenui/theme";
<DashboardStats
title="Overview"
currency="USD"
data={{
"7d": [{ label: "Revenue", value: 48250, change: 12.4, trend: [30, 34, 31, 38, 42, 40, 48], format: "currency" } /* … */],
"30d": [/* … */],
}}
/>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 period18.400 €
Churn
Down 0,4 % vs previous period2,1 %
import { DashboardStats } from "@/components/sheenui/blocks/dashboard-stats";
// Package build (after the first npm release, or a packed tarball): import { DashboardStats } from "@sheenui/theme";
<DashboardStats
title="Team health"
currency="EUR"
locale="de-DE"
data={{
"4w": [
{ label: "Revenue", value: 18400, change: 6.2, trend: [11, 12, 14, 13, 16, 18], format: "currency" },
{ label: "Churn", value: 2.1, change: -0.4, trend: [3, 2.8, 2.6, 2.4, 2.2, 2.1], format: "percent", goodWhen: "down" },
],
"12m": [
{ label: "Revenue", value: 212000, change: 18.9, trend: [90, 110, 130, 160, 190, 212], format: "currency" },
{ label: "Churn", value: 2.4, change: 0.3, trend: [2.1, 2.0, 2.2, 2.3, 2.3, 2.4], format: "percent", goodWhen: "down" },
],
}}
/>Props
DashboardStatsLabels keys and English defaults (4)
Keyboard
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
Related pages
20 blocks pages in all: browse them on All blocks.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .