Aus dem Quell-Repository gerendert; Überschriften, Beispiele, Code, Tabellen, Links und Bilder bleiben erhalten.
dashboardcn
Dashboard components for shadcn/ui, distributed as a shadcn registry. Nothing is published to npm. Each item is copied into the project with the shadcn CLI, so the code is the user's to edit.
Docs: https://dashboardcn.com. Every docs page is also Markdown: append .md to its URL. The index is https://dashboardcn.com/llms.txt.
Where files land
| Registry type | Lands in | Examples |
|---|---|---|
| Component (primitive) | components/ui/<name>.tsx | kpi-card, trend-chart, data-table |
| Block (composed card) | components/<name>.tsx | kpi-row-card, data-table-card |
| Lib | lib/format.ts | formatNumber, formatDelta, computeDelta |
Blocks pull in the primitives they are built from, plus the shadcn/ui items they need (card, tabs, tooltip, table, ...) and npm dependencies (recharts, @tanstack/react-table, lucide-react).
Workflow
- Check the project is a shadcn/ui project. It needs a
components.json.
If missing, run npx shadcn@latest init first.
- Pick items from the catalog below. Prefer a block when its layout
matches the request. Drop to primitives when composing something custom.
- Install everything in one command.
npx shadcn@latest add @dashboardcn/kpi-row-card @dashboardcn/trend-chart@dashboardcn is in the shadcn registry directory, so no components.json setup is needed. If an older CLI does not recognize the namespace, use URLs:
npx shadcn@latest add https://dashboardcn.com/r/kpi-row-card.json https://dashboardcn.com/r/trend-chart.json- Read the docs for anything unfamiliar.
references/api.mdin this
skill summarizes every prop. The full page with examples and source is at https://dashboardcn.com/docs/components/<name>.md or https://dashboardcn.com/docs/blocks/<name>.md.
- Compose the page. When a prop is missing, edit the installed file
rather than wrapping it. That is the point of the registry model.
Catalog
| Need | Reach for |
|---|---|
| One headline number with a delta | kpi-card; metric-value for the number alone |
| A row of numbers in one card | kpi-row-card (sparklines), ring-kpi-card (rings), tick-kpi-card (progress out of a whole), metric-list (compact rows) |
| Trend over time | trend-chart (area, line, bar, stacked, horizontal); sparkline inline |
| Current vs previous period, switchable metrics | metric-tabs-chart-card |
| A balance or price with a chart | balance-chart-card |
| Bars with one period highlighted, range switcher | period-bar-chart-card; bar-chart alone |
| Mixed series, dual axes, reference lines | composed-chart |
| Part of a whole | donut-chart, distribution-bar; as cards: distribution-card, breakdown-card, allocation-card |
| Two metrics side by side with meters | dual-metric-card |
| Conversion steps and drop-off | funnel-chart (bars, or variant="flow" for tapering stages); as cards: funnel-chart-card (flow), stage-bars-card (list of pills) |
| Ranked list (top pages, referrers) | bar-list |
| Progress toward a goal or capacity | tick-bar, progress-card, radial-gauge, status-gauge-card, segmented-meter (zones), score-gauge-card (score with a breakdown), goal-chart-card (daily bars against a goal line) |
| Several goals at once | activity-rings; as a card: activity-rings-card |
| Distribution or histogram | dot-plot, dot-plot-card |
| Daily activity calendar | activity-heatmap; as a card with stats: contributions-card |
| Two-axis density (weekday × hour, region × month) | heatmap-chart; as a card: heatmap-chart-card |
| Multi-axis comparison or scores | radar-chart |
| Correlation, bubbles | scatter-chart |
| Flows between categories | sankey-chart |
| Tabular data (sort, filter, paginate, select) | data-table; in a card: data-table-card |
| Audit log, activity feed, version history | timeline |
| A hero number with a takeaway sentence | insight-card |
| Week/month/year switcher | period-tabs |
| Signed percentage change | delta-badge |
Data conventions
- Deltas are fractions.
delta={0.124}renders+12.4%. Exceptions:
distribution-card and dot-plot-card take an absolute delta in the same unit as the value. Use computeDelta(current, previous) from lib/format.
- Down can be good. Set
invertDelta(orinvertondelta-badge) for
churn, latency, errors, spend, so a decrease is colored positive.
- `format` is
"number" | "compact" | "currency" | "percent". Percent
values are fractions: value={0.46} with format="percent" shows 46%. currency is an ISO 4217 code, default USD. Large numbers abbreviate to $158K automatically via metric-value, with the full value in a tooltip.
- Trend arrays (
trend,sparklinedata) are plainnumber[], oldest
first.
- Chart data is an array of row objects.
xKeynames the x value and each
series key names a numeric field in the row:
const data = [
{ date: "2026-08-01", desktop: 186, mobile: 80 },
{ date: "2026-08-02", desktop: 305, mobile: 200 },
]- Colors accept any CSS color. Defaults cycle through the shadcn theme
tokens chart-1 to chart-5. Prefer tokens: "var(--chart-2)" or a Tailwind palette variable like "var(--color-emerald-500)".
- Period and option switchers on blocks are optional. Omit
periodsor
options to hide them. They work uncontrolled (defaultPeriod) or controlled (period + onPeriodChange).
Layout
Cards extend shadcn Card, so className works for spans and heights. Charts default to h-64 w-full; override with className (h-48, h-80). A typical page:
export default function Page() {
return (
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
<KpiCard label="Revenue" value={84120} format="currency" delta={0.124} trend={revenue} />
<KpiCard label="Orders" value={2865} delta={0.18} trend={orders} />
<KpiCard label="Refunds" value={42} delta={-0.06} invertDelta trend={refunds} />
<KpiCard label="Conversion" value={0.034} format="percent" delta={0.002} />
<MetricTabsChartCard className="md:col-span-2 lg:col-span-3" data={daily} xKey="date" metrics={tabs} />
<BreakdownCard title="Gross volume" items={channels} delta={0.15} />
<DataTableCard className="md:col-span-2 lg:col-span-4" title="Top products" columns={columns} data={products} searchKey="product" pageSize={5} />
</div>
)
}Use lg:col-span-2 for charts and tables, single columns for KPI cards and gauges, and full width for data tables. Keep one grid per page section.
Client and server
Components with state or recharts already declare "use client", so a Server Component page can render them directly and pass data as props. The page itself needs "use client" only when it owns state, such as a controlled period switcher or data-table-card with a toolbar that uses useState. Define data-table columns in a client module when cells render interactive elements.
Data table essentials
const helper = createDataTableColumnHelper<Product>()
const columns = helper.columns([
helper.accessor("name", {
header: ({ column }) => <DataTableColumnHeader column={column} title="Product" />,
}),
helper.accessor("revenue", {
header: ({ column }) => <DataTableColumnHeader column={column} title="Revenue" align="right" />,
cell: ({ row }) => <div className="text-right">{formatNumber(row.original.revenue, { format: "currency" })}</div>,
}),
])
<DataTable columns={columns} data={products} searchKey="name" pageSize={10} />enableRowSelection adds checkboxes (pass getRowId for stable ids), pinnedColumns needs a size on each pinned column, reorderable allows drag reordering, loading swaps rows for a skeleton, pending dims them. For a custom layout use useDataTable and lay out DataTableToolbar, DataTableSearch, DataTableViewOptions, DataTableContent, and DataTablePagination yourself.
Pitfalls
- Do not
npm install dashboardcn. It does not exist; use the shadcn CLI. - Do not pass percentages as whole numbers.
delta={12.4}renders+1240%. - Do not wrap a registry component to add a prop. Edit the installed file.
- A half donut needs both
sweep={180}andstartAngle={180};sweep
alone draws it rotated.
activity-heatmapandcontributions-carddates are ISOYYYY-MM-DDstrings.funnel-chart-cardandstage-bars-cardtake eithersteps/stagesplus a
caption, or ranges where every range carries its own steps and delta.
- Foundations are Tailwind v4 and the shadcn theme variables. Projects on
Tailwind v3 need the v4 upgrade first.
