React Web Analytics Dashboard Template
A web analytics dashboard template for React in the style of Plausible and Vercel Analytics, built from SheenUI charts. Use it as a Plausible style dashboard for a traffic screen in a SaaS app, with visitors, pageviews, bounce rate and visit duration in a KPI strip.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/analytics-demo-web.jsonWeb analytics
last 7 days
WebAnalyticsDashboardLiveDotKpiStripTrendChartTrendTable- +16 more
- +13 more
Live demo
Switch the range, toggle channels, pick a KPI: charts tween to the new data one after another while the frame stays put. Live is on: the online count rolls, the current day grows and the latest point pulses. Hover or arrow through the trend to read any day against the previous period.
example.com
Web analytics · Last 30 days
Unique visitors
Last 30 days
- Unique visitors
- Previous period
Realtime
Visitors in the last 60 seconds
Top pages
By unique visitors
Top referrers
Where visitors came from
Devices
Share of visitors
Countries
Unique visitors by country
import { WebAnalyticsDashboard } from "@/components/sheenui/blocks/analytics-web";
// Package build (after the first npm release, or a packed tarball): import { WebAnalyticsDashboard } from "@sheenui/theme";
import { webAnalyticsDemoLoader, webLiveStep } from "@/components/sheenui/blocks/analytics/demo-web";
// Package build (after the first npm release, or a packed tarball): import { webAnalyticsDemoLoader, webLiveStep } from "@sheenui/theme/demo-data";
export function Analytics() {
return <WebAnalyticsDashboard load={webAnalyticsDemoLoader} liveStep={webLiveStep} site="example.com" />;
}Files to copy
23 folders · 55 files · 4 packages
- From
theme/src/ blocks/{analytics-web.tsx, analytics-kit.ts, icons.tsx}components/button/components/charts/{bar-list.tsx, category-bar.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-pointer.tsx, chart-tip.tsx, chart-utils.ts, donut-chart.tsx, geo-map.tsx, heatmap.tsx, pie-chart.tsx, sparkline.tsx, streamgraph.tsx, streaming-chart.tsx}components/charts/category-bar/components/charts/chart-parts/components/charts/geo-map/components/charts/geo/components/charts/heatmap/components/charts/streamgraph/components/charts/streaming-chart/components/drawer/parts/sheet.tsxcomponents/kbd/components/menu/components/segmented/components/skeleton/components/spinner/components/status-icons/components/tabs/blocks/analytics/{bar-trend-chart.tsx, data.ts, glass.tsx, hooks.tsx, kpi.tsx, labels.ts, panel.tsx, shell.tsx, stacked-trend-chart.tsx, trend-chart.tsx, trend-frame.tsx}hooks/{use-controllable.ts, use-direction.ts, use-intersection.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}motion/{beat.ts, gate.ts, tokens.ts}lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, no-script-reveal.tsx, popup-a11y.ts, popup-motion.ts, state-light.tsx, warn-once.ts}styles/
- shadcn CLI (component only)
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/analytics-web.jsonRegistry item: analytics-web. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".
Your data, your language
load() receives the range, the active filters and an abort signal; return the data (or a promise). This preview stands in for an API with a 900 ms delay, formats everything for de-DE and translates the labels.
docs.example.com
Webanalyse · Letzte 7 Tage
Seitenaufrufe
Letzte 7 Tage
- Seitenaufrufe
- Vorzeitraum
Echtzeit
Besucher der letzten 60 Sekunden
Top-Seiten
Nach Besuchern
Top-Verweise
Woher die Besucher kamen
Geräte
Anteil der Besucher
Länder
Besucher nach Land
import { WebAnalyticsDashboard, type WebAnalyticsData } from "@/components/sheenui/blocks/analytics-web";
import { type AnalyticsLoader } from "@/components/sheenui/blocks/analytics/data";
// Package build (after the first npm release, or a packed tarball): import { WebAnalyticsDashboard, type AnalyticsLoader, type WebAnalyticsData } from "@sheenui/theme";
const load: AnalyticsLoader<WebAnalyticsData> = async ({ range, filters }, signal) => {
const res = await fetch(`/api/analytics?range=${range}&channels=${filters.join(",")}`, { signal });
if (!res.ok) throw new Error("Analytics API failed"); // shows the error state with Retry
return res.json();
};
<WebAnalyticsDashboard
site="docs.example.com"
load={load}
locale="de-DE"
defaultRange="7d"
defaultMetric="pageviews"
defaultLive={false}
labels={{
metrics: { visitors: "Besucher", pageviews: "Seitenaufrufe", bounceRate: "Absprungrate", duration: "Besuchsdauer" },
rangeNames: { "24h": "Letzte 24 Stunden", "7d": "Letzte 7 Tage", "30d": "Letzte 30 Tage", "90d": "Letzte 90 Tage", "12m": "Letzte 12 Monate" },
// … every string is in WebAnalyticsLabels
}}
/>Loading, empty and error states
The frame never disappears: skeletons hold every panel's place on the first load, later loads dim the charts under a scan line, and an empty or failed load says so in words (with Retry when the loader threw). Pin a state with status for docs and tests.
staging.example.com
Web analytics · Last 30 days
Unique visitors
Last 30 days
- Unique visitors
- Previous period
Realtime
Visitors in the last 60 seconds
Top pages
By unique visitors
Top referrers
Where visitors came from
Devices
Share of visitors
Countries
Unique visitors by country
import { WebAnalyticsDashboard } from "@/components/sheenui/blocks/analytics-web";
// Package build (after the first npm release, or a packed tarball): import { WebAnalyticsDashboard } from "@sheenui/theme";
import { webAnalyticsDemoLoader, webLiveStep } from "@/components/sheenui/blocks/analytics/demo-web";
// Package build (after the first npm release, or a packed tarball): import { webAnalyticsDemoLoader, webLiveStep } from "@sheenui/theme/demo-data";
<WebAnalyticsDashboard load={webAnalyticsDemoLoader} liveStep={webLiveStep} site="staging.example.com" status="loading" defaultLive={false} />Data
load is required: WebAnalyticsDashboard never invents numbers. Return your own data (or a promise of it) from load. For demos and prototypes use the sample loader and live step from the separate @sheenui/theme/demo-data module:
import { WebAnalyticsDashboard } from "@/components/sheenui/blocks/analytics-web";
// Package build (after the first npm release, or a packed tarball): import { WebAnalyticsDashboard } from "@sheenui/theme";
import { webAnalyticsDemoLoader, webLiveStep } from "@/components/sheenui/blocks/analytics/demo-web";
// Package build (after the first npm release, or a packed tarball): import { webAnalyticsDemoLoader, webLiveStep } from "@sheenui/theme/demo-data";
<WebAnalyticsDashboard load={webAnalyticsDemoLoader} liveStep={webLiveStep} />With the shadcn CLI the sample data is its own optional item, which also installs the dashboard (the “with demo data” command at the top of this page): npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/analytics-demo-web.json. The “component only” command under Files to copy leaves the sample data out, which is what a production build wants.
Props
WebAnalyticsLabels keys and English defaults (53)
WebAnalyticsData
AnalyticsShell props
AnalyticsLabels keys and English defaults (29)
AnalyticsState props
LiveDot props
PanelSkeleton props
TrendTable props
Build your own dashboard
The templates are made from analytics-kit.tsx: copy one template and swap its panels, or compose a new one from the same parts.
useAnalyticsDashboard(props, options)
AnalyticsPanel
KpiStrip
TrendChart · StackedTrendChart · BarTrendChart
Keyboard
Accessibility
- The dashboard is a labeled region (its title); panels are sections named by their headings; loading sets aria-busy and is announced once (“Loading new data…”, then “Dashboard updated”), never on every live tick.
- The KPI strip is a real tablist that controls the trend panel: “Unique visitors, tab, selected, 1 of 4”. Each delta reads in words (“Up 12.3% vs previous period”), with an arrow and a sign, so color is never the only signal.
- Rolling numbers are visual only: screen readers get the final value once. The online pill doesn't announce every change.
- Every chart has a Table view with the same numbers; charts are focusable and read point by point with the arrow keys (announced politely).
- Live and Compare are toggle buttons (aria-pressed) with descriptions; filter chips show a ✓ and are underlined in forced colors when pressed.
- Reduced motion: no draw-ins, glides, pulses or scans; numbers and charts jump to their values, fades stay short.
Performance
- Charts below the fold mount when they come within 320px of the viewport; their frame is reserved first, so nothing shifts.
- New data lands in a React transition, one panel per frame: visible panels ripple in order, panels off-screen catch up in idle time or when you scroll to them.
- Controls answer instantly (optimistic state) while the dashboard re-renders in the background, so a click never blocks the next frame.
- Loading dims the panels through a data attribute (CSS only): starting or finishing a load re-renders no chart.
- Glass budget: the header, the KPI strip and at most two panels per row blur what's behind them; controls inside the header don't add their own blur. Phones get a lighter blur.
- Live updates, the realtime stream and every pulse stop while the dashboard is off-screen or the tab is hidden. Only transform and opacity animate.
All exports on this page
AnalyticsGrid— 1 column below 42rem of container width, 2 up to 64rem, then 4.AnalyticsPanel— A glass card for one chart.AnalyticsShell— The frame of a dashboard: a container-query root (the grid adapts to the space it gets, not to the window) with a glass header.AnalyticsState— Whole-dashboard state under the header: no data, or the loader failed (with Retry).DashboardBackdrop— Soft, static colour light behind a dashboard so its glass always has something to refract.KpiStrip— One glass strip, four cells (2×2 on phones), hairlines between them.LiveDot— The live indicator: a ring that pings while live (paused off-screen and in hidden tabs).PanelSkeleton— Placeholder body: faint bars where the chart will be (opacity pulse only; still under reduced motion).StackedTrendChart— Stacked areas (e.g.TrendChart— The hero chart of a dashboard: gradient area, 2px line, dashed previous period.TrendTable— Table view of a TrendChart.WebAnalyticsDashboard— Props (see WebAnalyticsDashboardProps): site ("example.com"), ranges, filters (the five web channels).defaultAnalyticsLabels— The English AnalyticsLabels every dashboard starts from; spread it and override the strings you translate.defaultStackedTrendChartLabels— The English strings of StackedTrendChart; spread it into your own labels and change what you need.defaultWebAnalyticsLabels— The English WebAnalyticsLabels used when labels is omitted; a partial labels prop is merged over them.trendLegend— Legend items for a trend chart (series + dashed previous period when comparing).useAdaptiveGlass— Glass budget for a whole dashboard.useAnalyticsDashboard— Wires a dashboard: controllable range / filters / live / compare, the loader.
When to use the web analytics dashboard
- Use it for the traffic or site-stats screen of a SaaS app, where a strip of KPI tiles (visitors, pageviews, bounce rate, visit duration) sits above the charts that explain them.
- Use it for a client-facing site report where the trend chart shows the previous period dashed, a realtime panel streams the current visitors and active pages, while top pages, referrers, devices and a country map sit below.
- Connect it to your own API through load, which receives the range, the active filters and an abort signal, then set locale and labels to translate every number and string.
- Skip it when you need funnels and retention, or revenue figures: ProductDashboard covers user journeys and cohorts, and SaasRevenueDashboard handles MRR and churn, so pick the block that matches your data.
- Pair it with SegmentedControl for your own filters beside it, Switch for toggles in surrounding settings, and useAnalyticsDashboard if you build a custom dashboard from the same kit.
Frequently asked questions
Related pages
Guides that cover it
5 dashboards pages in all: browse them on All dashboards.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .