data/@mihcm/ui·v0.21.0·stable
Chart
Theme-aware Recharts wrapper. ChartContainer injects CSS custom properties from a ChartConfig while preserving the full Recharts composition and prop surface.
Live preview
Adjust the controls on the right; the preview and code update in real time.
example.tsxtsx
import { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig } from '@mihcm/ui/Chart';
import { Bar, BarChart, CartesianGrid, XAxis, YAxis } from 'recharts';
const config = {
desktop: { label: 'Desktop', color: 'var(--color-primary)' },
mobile: { label: 'Mobile', color: 'var(--color-accent)' },
} satisfies ChartConfig;
export function Example() {
return (
<ChartContainer config={config} className="h-[320px] w-full">
<BarChart accessibilityLayer data={data}>
<CartesianGrid vertical={false} />
<XAxis dataKey="month" tickLine={false} axisLine={false} />
<YAxis tickLine={false} axisLine={false} width={36} />
<ChartTooltip content={<ChartTooltipContent />} />
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
</BarChart>
</ChartContainer>
);
}Install
Both paths are valid. CLI ships the source into your repo (you own it). Install pins via npm.
npx @mihcm/cli add ChartCopies the source into
components/ds/Chart.tsx. You own the file. Use --out to override the directory or --force to overwrite.