Bar Chart

The BarChart component visualizes labeled numeric values as accessible vertical bars.

Usage & Examples

Monthly Volume

Monthly volume
Jan: 24JanFeb: 38FebMar: 31MarApr: 47Apr
monthly-volume.tsx
const chartData = [
  { label: "Jan", value: 24, color: "#2f80ed" },
  { label: "Feb", value: 38, color: "#27ae60" },
  { label: "Mar", value: 31, color: "#f2994a" },
  { label: "Apr", value: 47, color: "#9b51e0" },
]; 


<BarChart data={chartData} label="Monthly volume" />

Props API

17 props
Columns
Bar Chart props API
Default
Description
aria-labelstringNoariaAccessible label for the chart graphic.
classNamestringNostylingAdditional class name for the root.
dataChartDatum[]YespropsLabelled values rendered as vertical bars.
data-testidstringNotestingBackward-compatible alias for test ID attributes.
gapnumberNoprops8Gap between bars in SVG units.
heightnumberNoprops180Height of the SVG viewport.
labelReactNodeNopropsVisible chart label.
loadingbooleanNopropsfalseWhether the component should display a loading state.
paddingnumberNoprops24Inner SVG padding.
showGridbooleanNopropstrueWhether to render horizontal guide lines.
showLabelsbooleanNopropstrueWhether to render category labels below bars.
stateStateTypeNostylingVisual state class used for styling.