Bar chart preview

Bar chart

Grouped or stacked vertical bars with a value tooltip on hover or focus; every bar is reachable by keyboard.

  • Group
    Charts
  • Origin
    Inspired · Original (this library)
  • License
    MIT
  • Added
    Oct 22
npx shadcn@latest add @deank/bar-chart

The registry stays private. Install from the repo with a GitHub token — see the README.

Usage

import { BarChart } from "@/registry/components/bar-chart/bar-chart";

<BarChart data={[/* … */]} x={/* … */} series={[/* … */]} label="…" />

Props

PropTypeDefaultDescription
dataT[]
xkeyof T & string
seriesBarSeries[]
labelstringAccessible summary of the chart
stacked?booleanfalse
height?number240
formatValue?(v: number) => string(v) => v.toLocaleString()

When to use

Comparing amounts across a handful of categories or periods (up to about 20 bars), grouped or stacked.

When not to use

Long continuous series (use line-chart); a single value (use gauge or number-ticker).

Related

Line chart · Gauge · Data grid