Skip to main content

Overview

Monthly Revenue
Jan – Jun 2026
Bar Chart renders comparative bar data using Recharts. It supports vertical bars (column chart), horizontal bars, grouped bars, stacked bars, and interactive tooltips.

Installation


Usage


Variants

Simple Bar Chart

Grouped Bar Chart

Stacked Bar Chart

Horizontal Bar Chart


API Reference

Record<string, any>[]
required
Array of data objects. Each object represents one group on the category axis.
string
required
The key in each data object used as the category axis label (e.g. "month", "page").
BarConfig[]
required
Array of bar configurations. Each item: { key: string, label: string, color: string, stackId?: string }.
number
default:"300"
Chart height in pixels.
string
default:"vertical"
Bar direction. "vertical" = column chart; "horizontal" = bar chart.
string
default:"grouped"
Multi-bar layout. Values: grouped · stacked
boolean
default:"true"
Show background grid lines.
boolean
default:"true"
Show color legend below the chart.
boolean
default:"true"
Show interactive hover tooltips.
string
Additional class names for the chart container.

Accessibility

  • Charts include a <title> and <desc> inside the SVG for screen readers
  • Use aria-label on the chart container to describe the data
  • Provide a data table alternative for complex charts — charts are not accessible to all users
  • Tooltip content is announced via aria-live="polite" on hover

Do’s & Don’ts

Do

  • Use bar charts for comparing discrete categories (months, products, regions)
  • Use stacked bars to show part-to-whole relationships within each category
  • Keep bar count under 12 per group for readability
  • Use color tokens consistently — primary #0479CE for the main series

Don't

  • Don’t use bar charts for continuous time-series data — use Line Chart
  • Don’t use more than 4 grouped bars per category — use a table instead
  • Don’t start the value axis at a non-zero value — it distorts perception
  • Don’t rely solely on color to distinguish bars — add labels or patterns