Skip to content

pastetaste

Range KPI Dashboard

DataCardsInteraction

A dashboard card whose range switch makes KPI tiles count to new values and the bar chart reshape, with a second tab that swaps the bars for a ranked breakdown.

Paste it into Claude Code: it installs the component, asks for your brand and content, and places it on the page you name.

Install

Or by hand, in a Next.js project with shadcn set up. It writes components/pastetaste/range-kpi-dashboard.tsx.

npx shadcn@latest add https://pastetaste.com/r/range-kpi-dashboard.json

Prompt

Install the pastetaste component "Range KPI Dashboard" (range-kpi-dashboard) into this Next.js project and use it.

What it is: A dashboard card whose range switch makes KPI tiles count to new values and the bar chart reshape, with a second tab that swaps the bars for a ranked breakdown.

Before you place it, ask me (one short message, in my language; "skip" = sensible default): which page and section it goes in, my brand colour (hex), the text, labels or images it should show, and whether I want my logo or my own copy in the demo content. Then:

Steps:
1. If the project has no components.json, run: npx shadcn@latest init -y -d. Then run: npx shadcn@latest add https://pastetaste.com/r/range-kpi-dashboard.json
   (it writes components/pastetaste/range-kpi-dashboard.tsx; install any npm packages it reports).
2. Import it: import { RangeKpiDashboard } from "@/components/pastetaste/range-kpi-dashboard" (check the file for the exact named export).
3. Put it where it fits on the page I name, keep the rest of the page untouched, and pass props for my colours instead of editing the installed file.
4. It does not depend on Tailwind; colours come from CSS variables (--pt-*) or props.
5. It supports prefers-reduced-motion with a still state; do not remove it.

Props (all optional unless the type has no default):
- ranges: { id; kpis: number[]; bars: number[]; live? }[] = Today, 7 days, 30 days — One entry per range.
- kpiLabels / kpiSuffix / kpiDecimals: string[] / string[] / number[] = four ad metrics — Tile labels, suffixes and decimals.
- title: string = 'Campaign 0412 · Oat & Co.' — Card title.
- barsTab / breakdownTab / breakdown: string / string / { name; value }[] = 'Plays by hour' / 'Districts' / five districts — Second tab and its ranked rows (value 0 to 100).
- axis / barCaption: string[] / (i, v) => string = 00 06 12 18 23 / hour caption — Bottom labels and hover text.
- defaultRange: string = first range — Range id that starts selected.
- ink / muted / background / surface / fontFamily: string = warm neutral palette — Colours and font.
- className / style: string / CSSProperties — On the card.

Live preview: https://pastetaste.com/c/range-kpi-dashboard
Then run the dev server, check it in the browser at desktop and mobile width, and tell me the page URL.

Props 8

PropTypeDefaultDescription
ranges{ id; kpis: number[]; bars: number[]; live? }[]Today, 7 days, 30 daysOne entry per range.
kpiLabels / kpiSuffix / kpiDecimalsstring[] / string[] / number[]four ad metricsTile labels, suffixes and decimals.
titlestring'Campaign 0412 · Oat & Co.'Card title.
barsTab / breakdownTab / breakdownstring / string / { name; value }[]'Plays by hour' / 'Districts' / five districtsSecond tab and its ranked rows (value 0 to 100).
axis / barCaptionstring[] / (i, v) => string00 06 12 18 23 / hour captionBottom labels and hover text.
defaultRangestringfirst rangeRange id that starts selected.
ink / muted / background / surface / fontFamilystringwarm neutral paletteColours and font.
className / stylestring / CSSProperties-On the card.
View all →