panelui

Bar Chart

Component

About

Categories compared by length, grouped or stacked.

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/panel-bar-chart';
const REVENUE = [
  { month: 'Mar', revenue: 19_800, costs: 12_100 },
  { month: 'Apr', revenue: 24_600, costs: 13_400 },
  { month: 'May', revenue: 27_100, costs: 14_900 },
  { month: 'Jun', revenue: 25_300, costs: 15_200 },
  { month: 'Jul', revenue: 29_900, costs: 16_800 },
  { month: 'Aug', revenue: 32_400, costs: 17_300 },
];

export default function BarChartGrouped() {
  return (
    <BarChart data={REVENUE} xDataKey="month" className="max-w-lg">
      <BarChart.Grid />
      <BarChart.Bar dataKey="revenue" />
      <BarChart.Bar dataKey="costs" color="chart-3" />
      <BarChart.XAxis />
      <BarChart.Legend labels={{ revenue: 'Revenue', costs: 'Costs' }} />
      <BarChart.Tooltip
        labels={{ revenue: 'Revenue', costs: 'Costs' }}
        formatValue={(value) => `$${value.toLocaleString('en-US')}`}
      />
    </BarChart>
  );
}

Dependencies

More by panelui

View all
  • Spinner

    Spinner

    7
  • Flow

    Flow

    4
  • Hex Chart

    Hex Chart

    2
  • Treemap Chart

    Treemap Chart

    1
  • Soundwave

    Soundwave

    1
  • Share

    Share

    1
  • Scatter Chart

    Scatter Chart

    1
  • Pyramid Chart

    Pyramid Chart

    1