Commerce Analytics
An e-commerce analytics dashboard: a four-up KPI row with period deltas, a net-profit area chart, a repeat-purchase-rate radial gauge, a busiest-weekday bar chart, and a best-selling-products table with an inline sparkline per row.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/commerce-analytics.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/dashboard/dashboard3.tsx instead.
Usage
The file also exports dashboard3Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Dashboard3, dashboard3Demo } from "@/components/blocks/dashboard/dashboard3"; export default function Page() { return <Dashboard3 {...dashboard3Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| navItems | NavItem[] | none | Static sidebar nav entries. Icons are assigned by position, not passed in as data. |
| kpis | KpiItem[] | none | Four-up KPI tiles (Revenue, Orders, AOV, Conversion) with trend badges. |
| netProfitData | number[] | none | Weekly net-profit values plotted as an area chart, oldest to newest. |
| repeatRate | number | none | Repeat purchase rate percentage (0-100) shown in the radial gauge. |
| weekdayData | number[] | none | Seven order-count values, Monday through Sunday, plotted as a bar chart. |
| products | ProductRow[] | none | Best-selling products table rows, each with an inline sparkline of its recent trend. |
| className | string | none | Extra classes for the outer section element. |
Types
type NavItem = { label: string; href: string; active?: boolean }; type KpiItem = { label: string; value: string; delta: string; trend: "up" | "down" }; type ProductRow = { name: string; unitsSold: number; revenue: string; trend: number[]; // rendered as a small inline sparkline };
Behavior notes
- This is a fully static server component: every chart (area, bar, radial gauge, sparklines) is inline SVG computed from the fixed arrays you pass in, no client JS or chart library involved.
- The topbar search input is decorative: it accepts keystrokes like any input but has no live filtering wired up, matching the brief's optional-period-toggle guidance for this block.
- The sidebar has no collapse control here (unlike the Admin Shell block); it's a static hidden-below-lg rail.
- Sparkline color, area fill, bar chart, and the radial gauge all read their color from `currentColor`/`text-primary`, so they follow the active theme automatically.
More Dashboard Blocks
View all →admin-shell
Admin Shell
Full admin dashboard frame with a collapsible icon sidebar, command-palette trigger, KPI row, and recent-orders table.
customers-table
Customers Table
Sortable, searchable customers table with row selection, pagination, and a per-row action menu.
project-workspace
Project Workspace
Project-management dashboard with a highlighted stats row, weekly hours chart, meeting reminder, team list, progress gauge, and a focus tracker.
booking-workspace
Booking Workspace
Split hotel booking dashboard with tabbed overview, active booking cards, room timelines, and a month calendar with a day agenda.
talent-sourcing
Talent Sourcing
Recruiting project dashboard with a five-up stat strip, stage-filtered candidate pipeline, live search, and per-card wishlist/invite toggles.
traffic-analytics
Traffic Analytics
Web analytics console with a live-visitors strip, an hourly sessions area chart, a channel radar chart, a new-vs-returning line chart, and a sortable top-pages table.