About
A single-series bar chart for shadcn/ui with gradient or striped fills, a highlighted subset of bars, and a hover marker. Use it for spend by week, signups by day, or anything where one series and a highlighted period tell the story.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Bar Chart to your project and fits it to your theme.
Code
How Bar Chart is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client"
import { BarChart } from "@/components/ui/dashboardcn-bar-chart"
import { formatNumber } from "@/components/ui/dashboardcn-bar-chart"
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
const data = months.flatMap((month, m) =>
Array.from({ length: 4 }, (_, w) => ({
week: `${month} week ${w + 1}`,
month,
spend:
month === "Mar"
? 1_900 + w * 470
: 900 + Math.round(Math.abs(Math.sin(m * 4 + w)) * 500),
}))
)
export default function BarChartDemo() {
return (
<BarChart
data={data}
xKey="week"
yKey="spend"
groupKey="month"
color="var(--color-orange-500)"
grid="none"
highlight={(row) => row.month === "Mar"}
yFormatter={(value) => formatNumber(value, { format: "currency" })}
tooltipLabel={(row) => String(row.week).replace(/^\w+ /, "")}
/>
)
}
















