Bar Chart

Lightweight React bar chart with rounded bars, dashed gridlines and labels. Hovering a bar dims the rest and shows its value; the peak is highlighted first.

src/registry/ui/bar-chart.tsx/r/bar-chart.json

Installation#

bash
npx shadcn@latest add @minidev/bar-chart

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/bar-chart.json

Usage#

tsx
import { BarChart } from "@/components/ui/bar-chart"

export function Example() {
  return (
    <BarChart data={[{label:"Mon",value:12},{label:"Tue",value:18},{label:"Wed",value:9},{label:"Thu",value:22},{label:"Fri",value:16}]} />
  )
}

API reference#

BarChart props
PropTypeDefault
data{ label: string; value: number }[]SAMPLE_DATA
classNamestring-
labelstring"Bar chart"
format(n: number) => string(n: number) => n.toLocaleString()

Examples#

All chart components

Learn more