Staaarter

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.

By Staaarter Team
Dashboard
Docs
Live preview

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.json

Prefer 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

PropTypeDefaultDescription
navItemsNavItem[]noneStatic sidebar nav entries. Icons are assigned by position, not passed in as data.
kpisKpiItem[]noneFour-up KPI tiles (Revenue, Orders, AOV, Conversion) with trend badges.
netProfitDatanumber[]noneWeekly net-profit values plotted as an area chart, oldest to newest.
repeatRatenumbernoneRepeat purchase rate percentage (0-100) shown in the radial gauge.
weekdayDatanumber[]noneSeven order-count values, Monday through Sunday, plotted as a bar chart.
productsProductRow[]noneBest-selling products table rows, each with an inline sparkline of its recent trend.
classNamestringnoneExtra 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.