About
An animated SVG bar chart for comparing values across categories, with grouped or stacked bars, a hover tooltip, legend and keyboard-readable data table.
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/chart-bar";
import { TrendingUp } from "lucide-react";
const data = [
{ month: "Jan", desktop: 186, mobile: 80 },
{ month: "Feb", desktop: 305, mobile: 200 },
{ month: "Mar", desktop: 237, mobile: 120 },
{ month: "Apr", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "Jun", desktop: 214, mobile: 140 },
];
export default function BarChartDemo() {
return (
<div className="flex w-full min-w-0 justify-center px-4 py-12">
<div className="w-full max-w-xl rounded-xl border border-border bg-card text-card-foreground">
<div className="grid gap-1 p-5 pb-2">
<p className="font-semibold leading-none">Visitors by device</p>
<p className="text-sm text-muted-foreground">January – June 2026</p>
</div>
<div className="px-5 pt-4">
<BarChart
data={data}
index="month"
series={[
{ key: "desktop", label: "Desktop" },
{ key: "mobile", label: "Mobile" },
]}
title="Monthly visitors by device, January to June 2026"
/>
</div>
<div className="grid gap-1.5 p-5 pt-3 text-sm">
<p className="flex items-center gap-2 font-medium leading-none">
Trending up by 5.2% this month <TrendingUp className="size-4" />
</p>
<p className="leading-none text-muted-foreground">
Showing total visitors for the last 6 months
</p>
</div>
</div>
</div>
);
}
















