About
A themed chart card with a title, a one-line takeaway, and an SVG plot (bar, line, area, pie, radar, radial) that draws itself in once scrolled into view, with optional center content and a custom tooltip.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Chart to your project and fits it to your theme.
Code
How Chart is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import Chart from "@/components/ui/chart";
import { barY, defineChart } from "@tanstack/charts";
import { scaleBand } from "@tanstack/charts/scales/band";
import { scaleLinear } from "@tanstack/charts/scales/linear";
import { tooltip } from "@tanstack/charts/tooltip";
const loans = [
{ month: "Jan", loans: 412 },
{ month: "Feb", loans: 486 },
{ month: "Mar", loans: 531 },
{ month: "Apr", loans: 468 },
{ month: "May", loans: 597 },
{ month: "Jun", loans: 642 },
];
const definition = defineChart({
marks: [barY(loans, { x: "month", y: "loans", radius: 4 })],
scales: {
x: {
scale: () => scaleBand<string>().padding(0.3),
axis: { label: "Month" },
},
y: {
scale: scaleLinear,
nice: true,
grid: true,
axis: { label: "Loans", ticks: { count: 5 } },
},
},
tooltip,
});
export default function ChartDemo() {
return (
<div className="flex w-full items-center justify-center p-10">
<div className="w-full max-w-xl">
<Chart
title="Loans per month"
description="Loans dipped in April, then rose to their highest in June."
definition={definition}
/>
</div>
</div>
);
}








