UI
BarChart
Responsive bar charts powered by Recharts with multi-series and stacked support.
Preview
Installation
npm install recharts
Usage
import { BarChart } from '@/components/ui/BarChart'const data = [{ month: 'Jan', revenue: 4200, expenses: 2800 },{ month: 'Feb', revenue: 5800, expenses: 3100 },// ...]export default function Page() {return (<BarChartdata={data}xAxisKey="month"series={[{ dataKey: 'revenue', name: 'Revenue', color: '#F45A5A' },{ dataKey: 'expenses', name: 'Expenses', color: '#6366f1' },]}/>)}
Variants
Single Series
Stacked
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
data* | BarChartDataPoint[] | - | Array of data objects |
series* | BarChartSeries[] | - | Series definitions with dataKey, name, color |
xAxisKey* | string | - | Key in data used for X axis labels |
height | number | 300 | Chart height in pixels |
showGrid | boolean | true | Show background grid lines |
showLegend | boolean | true | Show series legend |
showTooltip | boolean | true | Show hover tooltip |
stacked | boolean | false | Stack bars on top of each other |
className | string | - | Extra CSS classes for the wrapper |