Bar Chart V2
Basic
A grouped bar chart rendered as static SVG at build time, with no JavaScript. The chart renders at its design size, shrinks to fit narrow containers, and never scales up. Colours come from a validated categorical palette with dedicated dark theme steps. Hover a bar for its value, or open View data for the table.
<BarChartV2 label="Two series across four groups" xLabel="Group" yLabel="Value" data={[ { label: 'One', values: [30, 45] }, { label: 'Two', values: [52, 38] }, { label: 'Three', values: [41, 60] }, { label: 'Four', values: [74, 55] }, ]} series={[{ label: 'Series a' }, { label: 'Series b' }]}/>Single series
With one series the legend is omitted and the label prop names the chart.
<BarChartV2 label="A single series" data={[ { label: 'One', values: [1200] }, { label: 'Two', values: [2400] }, { label: 'Three', values: [1800] }, { label: 'Four', values: [3100] }, { label: 'Five', values: [2650] }, ]} series={[{ label: 'Series a' }]} height={240}/>Many groups
Twenty groups in a single series. Bars share the group scale evenly, and group labels thin to every nth automatically when there is not enough room for all of them.
<BarChartV2 label="Twenty bars in a single series" data={Array.from({ length: 20 }, (_, index) => ({ label: String(index + 1), values: [Math.round(45 + 35 * Math.sin(index / 3) + (index % 5) * 4)], }))} series={[{ label: 'Series a' }]}/>Colour with many bars
Colour identifies series, so a chart with many bars gets colour from having several series. Three series across twenty groups renders sixty coloured bars, with the legend and gaps carrying identity at small sizes. The built-in palette covers eight series and further series receive generated evenly spaced hues.
<BarChartV2 label="Three series across twenty groups" data={Array.from({ length: 20 }, (_, index) => ({ label: String(index + 1), values: [ Math.round(40 + 30 * Math.sin(index / 3)), Math.round(35 + 25 * Math.sin(index / 4 + 2)), Math.round(30 + 20 * Math.sin(index / 5 + 4)), ], }))} series={[{ label: 'Series a' }, { label: 'Series b' }, { label: 'Series c' }]}/>Custom colours
Each series accepts a color override, and the palette prop replaces the whole default palette. Overrides apply to every theme, so check their contrast on the surfaces you use.
<BarChartV2 label="Custom series colours" data={[ { label: 'One', values: [18, 31, 24] }, { label: 'Two', values: [26, 22, 35] }, { label: 'Three', values: [33, 40, 28] }, ]} series={[ { label: 'Series a' }, { label: 'Series b', color: '#0c6b6b' }, { label: 'Series c' }, ]}/>Horizontal
orientation renders the bars horizontally: groups run down the left edge and the value axis sits along the bottom. Long group labels truncate with an ellipsis instead of tilting.
<BarChartV2 title="Horizontal bars" orientation="horizontal" xLabel="Value" data={[ { label: 'One', values: [64, 41] }, { label: 'Two', values: [38, 52] }, { label: 'Three', values: [55, 30] }, { label: 'Four', values: [27, 45] }, ]} series={[{ label: 'Series a' }, { label: 'Series b' }]} height={280}/>Stacked
stacked places the series on top of one another within each group, so the bar length shows the group total. The value axis scales to the largest total.
<BarChartV2 title="Stacked columns" stacked data={[ { label: 'One', values: [22, 34, 18] }, { label: 'Two', values: [30, 16, 25] }, { label: 'Three', values: [17, 28, 21] }, { label: 'Four', values: [26, 19, 32] }, ]} series={[{ label: 'Series a' }, { label: 'Series b' }, { label: 'Series c' }]}/>Stacked horizontal
Stacking and orientation compose. Each segment keeps its own hover value and data attributes.
<BarChartV2 title="Stacked horizontal bars" stacked orientation="horizontal" xLabel="Value" data={[ { label: 'One', values: [22, 34, 18] }, { label: 'Two', values: [30, 16, 25] }, { label: 'Three', values: [17, 28, 21] }, { label: 'Four', values: [26, 19, 32] }, ]} series={[{ label: 'Series a' }, { label: 'Series b' }, { label: 'Series c' }]} height={240}/>Colour scale
colorScale generates one colour per series by interpolating between its anchors in OKLCH. Explicit series colours and the palette prop still take precedence when set.
<BarChartV2 title="Colour scale across six series" stacked colorScale={['#1baf7a', '#4a3aa7']} data={[ { label: 'One', values: [12, 18, 9, 14, 7, 11] }, { label: 'Two', values: [15, 11, 13, 8, 12, 9] }, { label: 'Three', values: [9, 14, 16, 11, 8, 13] }, { label: 'Four', values: [13, 9, 11, 15, 10, 8] }, ]} series={[ { label: 'Series a' }, { label: 'Series b' }, { label: 'Series c' }, { label: 'Series d' }, { label: 'Series e' }, { label: 'Series f' }, ]}/>Title
The title prop renders a heading above the chart. It also becomes the accessible name, unless the label prop is set to override it.
<BarChartV2 title="Chart title" data={[ { label: 'One', values: [30, 45] }, { label: 'Two', values: [52, 38] }, { label: 'Three', values: [41, 60] }, { label: 'Four', values: [74, 55] }, ]} series={[{ label: 'Series a' }, { label: 'Series b' }]}/>Legend placement
The legend prop controls the key. auto shows it only for two or more series, top and bottom force its position, and hidden removes it.
<BarChartV2 label="Legend below the chart" legend="bottom" data={[ { label: 'One', values: [30, 45] }, { label: 'Two', values: [52, 38] }, { label: 'Three', values: [41, 60] }, { label: 'Four', values: [74, 55] }, ]} series={[{ label: 'Series a' }, { label: 'Series b' }]}/>Sparkline
Setting axes to false drops the ticks, labels, and baseline so their margins collapse, leaving just the bars. The same chart works across sizes, shown here from a tiny inline sparkline up to a larger block.
<Inline space="large" alignY="center"> {sizes.map((size) => ( <BarChartV2 label="Sparkline" axes={false} width={size.width} height={size.height} data={data} series={series} /> ))}</Inline>Months of the year
Twelve months in a single series, one value each. Group labels thin automatically if the chart is too narrow to fit all twelve.
<BarChartV2 label="Values by month" xLabel="Month" yLabel="Value" data={data} series={[{ label: 'Series a' }]}/>Full month names
Full month names are too wide to sit flat, so every label tilts to -45 degrees. Tilted labels run parallel and never collide, so they only truncate with an ellipsis when one would hang past about a third of the chart height.
<BarChartV2 label="Values by month" xLabel="Month" yLabel="Value" data={data} series={[{ label: 'Series a' }]}/>Build status
Custom colours turn two series into a red and green build tracker: passed builds in green, failed in red. Shown as a full chart and a compact axis-less variant.
<Stack space="large"> <BarChartV2 title="Build status" xLabel="Day" yLabel="Builds" data={data} series={series} />
<BarChartV2 label="Build status sparkline" axes={false} width={280} height={80} data={data} series={series} /></Stack>