Chart foundations built on TanStack Charts, shared by every Preskok chart component.
Every Preskok chart is built on TanStack Charts v1.
The chart registry item holds what they share: the chart frame, the interactive
legend, the tooltip, the --chart-* palette, and the mount animation. Install a
chart component and chart comes with it.
npx shadcn@latest add @preskok/chartEach chart takes the same config-driven data shape. Keys in config name the
series in each row, and colors come from the --chart-1 to --chart-5 tokens in
globals.css, so charts follow light and dark themes.
import { AreaChart } from "@/components/ui/preskok-ui/area-chart"
import { ChartLegend } from "@/components/ui/preskok-ui/chart"
const data = [
{ month: "Jan", revenue: 42, sales: 28 },
{ month: "Feb", revenue: 64, sales: 39 },
]
const config = {
revenue: { label: "Revenue", color: "var(--chart-1)" },
sales: { label: "Sales", color: "var(--chart-2)" },
} as const
export function RevenueChart() {
return (
<AreaChart
config={config}
data={data}
dataKey="month"
legend={<ChartLegend align="left" />}
size={{ height: 256 }}
valueFormatter={(value) => `$${value}k`}
/>
)
}--chart-* tokenssize (height, aspectRatio, initialWidth)The earlier Recharts components are deprecated. The props are close but not identical:
| Recharts | TanStack |
|---|---|
className="h-64" | size={{ height: 256 }} |
hideGridLines | grid="hidden" |
hideXAxis, xAxisProps | xAxis={false}, xAxis={{ ... }} |
hideYAxis, yAxisProps | yAxis={false}, yAxis={{ ... }} |
legendProps | legend={<ChartLegend ... />} |
| Any color string | var(--chart-1) to var(--chart-5) |
barProps={{ onClick }} | onBarClick={(row) => ...} |
xAxisProps={{ interval: 0 }} | categoryAxis={{ tickStrategy: "all", labelRotation: -35 }} |