preskok/ui

Bar Chart

Bar chart component built on Recharts with legend, tooltip, and stacking support.

Installation

pnpm dlx @preskok-org/ui@latest add bar-chart

Usage

import { BarChart } from "@/registry/preskok/ui/preskok-ui/bar-chart"
 
const chartData = [
  { month: "January", Desktop: 186, Mobile: 80 },
  { month: "February", Desktop: 305, Mobile: 200 },
]
 
const chartConfig = {
  Desktop: { label: "Desktop", color: "#2563eb" },
  Mobile: { label: "Mobile", color: "#60a5fa" },
}
 
export function BarChartDemo() {
  return <BarChart data={chartData} dataKey="month" config={chartConfig} />
}

Features

  • Stacked/percent modes
  • Legend selection with interactive filtering
  • Config-driven colors and labels
  • Responsive container