Bar Chart
ProBar chart for comparing values: grouped, horizontal, diverging, top-k and highlighted bars, with tooltip, keyboard navigation and a data table.
Playground Bar Charts
Bar Charts
| month | Revenue | Expenses |
|---|---|---|
| Jan | 32k | 18k |
| Feb | 41k | 22k |
| Mar | 38k | 27k |
| Apr | 47k | 24k |
| May | 44k | 30k |
| Jun | 52k | 28k |
| Jul | 49k | 34k |
| Aug | 55k | 31k |
| Sep | 51k | 36k |
| Oct | 46k | 33k |
| Nov | 53k | 38k |
| Dec | 58k | 35k |
Playground Shapes
Bar Charts
- Revenue
| month | Revenue |
|---|---|
| Jan | 32k |
| Feb | 41k |
| Mar | 38k |
| Apr | 47k |
| May | 44k |
| Jun | 52k |
| Jul | 49k |
| Aug | 55k |
| Sep | 51k |
| Oct | 46k |
| Nov | 53k |
| Dec | 58k |
Playground Values
Bar Charts
- Profit
| month | Profit |
|---|---|
| Jan | 18k |
| Feb | 26k |
| Mar | -8k |
| Apr | 14k |
| May | 32k |
| Jun | -15k |
| Jul | 22k |
| Aug | 9k |
| Sep | -4k |
| Oct | 28k |
| Nov | 35k |
| Dec | -12k |
Playground Horizontal
Bar Charts
- Sessions
| country | Sessions |
|---|---|
| DE | 53k |
| US | 48k |
| UK | 40k |
| FR | 34k |
| ES | 28k |
| IT | 22k |
| NL | 14k |
Playground Hero
Bar Charts
- Revenue
| month | Revenue |
|---|---|
| Jan | 32k |
| Feb | 41k |
| Mar | 38k |
| Apr | 47k |
| May | 44k |
| Jun | 52k |
| Jul | 49k |
| Aug | 55k |
| Sep | 51k |
| Oct | 46k |
| Nov | 53k |
| Dec | 58k |
Installation
Bar Chart comes with WunderUI Core and Pro, in the package from your plan. See the plans.
The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.
Then import what you need:
import {
BarChart,
BarChartProps,
BarChartVariant,
} from "@wunderui/react/charts"Then use it:
import { BarChart } from "@wunderui/react/charts"
const data = [
{ month: "Jan", revenue: 32000 },
{ month: "Feb", revenue: 41000 },
{ month: "Mar", revenue: 38000 },
{ month: "Apr", revenue: 47000 },
]
export function RevenueBars() {
return <BarChart data={data} index="month" series={[{ key: "revenue", label: "Revenue" }]} label="Revenue" />
}Expected result: You should see four columns rising from a zero line, with the months below. Hovering a column lights a band and opens a tooltip.
When to use
Use Bar Chart for
- Comparing values across categories
- Two or three series side by side (grouped bars)
- A ranking, as horizontal bars or a top-k list with the rest summed into Others
- Gains and losses around zero, or two sides compared (butterfly)
Use something else for
- Line Chart for a trend over many points in time
- Stacked Chart for the parts that make up each total
- Range Bar Chart for a span from a minimum to a maximum per category
- Distribution Chart for raw observations that need binning
States
Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.
Bar Charts
| month | Revenue | Expenses |
|---|---|---|
| Jan | 32k | 18k |
| Feb | 41k | 22k |
| Mar | 38k | 27k |
| Apr | 47k | 24k |
| May | 44k | 30k |
| Jun | 52k | 28k |
| Jul | 49k | 34k |
| Aug | 55k | 31k |
| Sep | 51k | 36k |
| Oct | 46k | 33k |
| Nov | 53k | 38k |
| Dec | 58k | 35k |
Patterns
A fill pattern from the shared pattern library helps in print and where colour alone is not enough. One pattern form per chart — stripes, dots or cross-hatch — for every series; the series stay apart by their colour. A patterned bar is at least 20 px wide: on a narrow chart neighbouring months are gathered first.
Bar Charts
| month | Total Profits | Income | Expenses |
|---|---|---|---|
| Jan | 34k | 28k | 20k |
| Feb | 40k | 41k | 31k |
| Mar | 28k | 25k | 15k |
| Apr | 46k | 50k | 38k |
| May | 38k | 38k | 26k |
| Jun | 52k | 48k | 45k |
| Jul | 44k | 47k | 33k |
| Aug | 49k | 48k | 43k |
| Sep | 36k | 31k | 26k |
| Oct | 54k | 56k | 40k |
| Nov | 47k | 45k | 38k |
| Dec | 42k | 36k | 29k |
Forecast
forecastFrom marks where the forecast starts: a dashed divider with its label, and from there the bars are striped with a rim in the series colour. The legend names Actual and Forecast.
Revenue
| month | Revenue | Revenue forecast |
|---|---|---|
| Jan | 32k | – |
| Feb | 41k | – |
| Mar | 38k | – |
| Apr | 47k | – |
| May | 44k | – |
| Jun | 52k | – |
| Jul | 49k | – |
| Aug | 55k | – |
| Sep | 51k | – |
| Oct | – | 54k |
| Nov | – | 58k |
| Dec | – | 61k |
Trendline
trendline draws the least-squares line through each series, dotted in a lighter step of its colour. Pass true for every series or a list of keys.
Revenue
| month | Revenue | Revenue trend | Expenses | Expenses trend |
|---|---|---|---|---|
| Jan | 32k | 36.3k | 18k | 21.2k |
| Feb | 41k | 38.5k | 22k | 22.7k |
| Mar | 38k | 40.7k | 27k | 24.3k |
| Apr | 47k | 43k | 24k | 25.8k |
| May | 44k | 45.2k | 30k | 27.3k |
| Jun | 52k | 47.4k | 28k | 28.9k |
| Jul | 49k | 49.6k | 34k | 30.4k |
| Aug | 55k | 51.8k | 31k | 32k |
| Sep | 51k | 54k | 36k | 33.5k |
| Oct | 54k | 56.3k | 33k | 35.1k |
| Nov | 58k | 58.5k | 38k | 36.6k |
| Dec | 61k | 60.7k | 35k | 38.2k |
Event markers
events pins what happened to the bars: a dotted line over the plot and an icon button above it. Hover or focus a button for the label and detail; two events at one point share a button with a counter.
Revenue
| month | Revenue | Expenses | Events |
|---|---|---|---|
| Jan | 32k | 18k | – |
| Feb | 41k | 22k | – |
| Mar | 38k | 27k | Price change: Pro plan from $19 to $24 a month |
| Apr | 47k | 24k | – |
| May | 44k | 30k | – |
| Jun | 52k | 28k | – |
| Jul | 49k | 34k | Summer campaign: Paid social in three markets |
| Aug | 55k | 31k | – |
| Sep | 51k | 36k | – |
| Oct | 54k | 33k | Release 2.0: Team workspaces and SSO |
| Nov | 58k | 38k | – |
| Dec | 61k | 35k | – |
Range
range highlights a stretch of categories with grey stripes behind the bars, with an optional label at the top.
Revenue
| month | Revenue | Expenses | Summer sale |
|---|---|---|---|
| Jan | 32k | 18k | – |
| Feb | 41k | 22k | – |
| Mar | 38k | 27k | – |
| Apr | 47k | 24k | – |
| May | 44k | 30k | – |
| Jun | 52k | 28k | Yes |
| Jul | 49k | 34k | Yes |
| Aug | 55k | 31k | Yes |
| Sep | 51k | 36k | – |
| Oct | 54k | 33k | – |
| Nov | 58k | 38k | – |
| Dec | 61k | 35k | – |
Background texture
texture swaps the grid lines for a quiet background behind the bars — dots, diagonal lines or a fine grid in the grid colour, faded out at all four edges. It replaces the grid, never adds to it; the zero line stays for the marks to stand on. One decorative layer per chart: no texture together with a pattern or a glow.
Revenue
| month | Revenue | Expenses |
|---|---|---|
| Jan | 32k | 18k |
| Feb | 41k | 22k |
| Mar | 38k | 27k |
| Apr | 47k | 24k |
| May | 44k | 30k |
| Jun | 52k | 28k |
| Jul | 49k | 34k |
| Aug | 55k | 31k |
| Sep | 51k | 36k |
| Oct | 54k | 33k |
| Nov | 58k | 38k |
| Dec | 61k | 35k |
Ghost trail
ghost draws the previous period behind the current one as a faint dashed column behind each bar, in the series colour at --chart-hidden. Pass the field that holds last period's value, or { key, label, series }. The tooltip lists it under its series, the data table adds a column, and the legend shows it as a faint ring (ghost: true).
Revenue
| month | Revenue | Last year |
|---|---|---|
| Jan | 32k | 27k |
| Feb | 41k | 33k |
| Mar | 38k | 35k |
| Apr | 47k | 39k |
| May | 44k | 42k |
| Jun | 52k | 44k |
| Jul | 49k | 41k |
| Aug | 55k | 47k |
| Sep | 51k | 49k |
| Oct | 54k | 46k |
| Nov | 58k | 50k |
| Dec | 61k | 53k |
Legend on small cards
On a card under 560 px the legend keeps to one row: the badges that fit stay, the rest wait behind a +n button that opens the full legend (Less closes it again). Wider cards wrap the badges as before. Drag the grip to see the row fill up.
Visitors by channel
| month | Organic search | Paid search | Social media | Newsletter | Partners |
|---|---|---|---|---|---|
| Jan | 4.2k | 2.6k | 1.8k | 1.2k | 700 |
| Feb | 4.6k | 2.9k | 2.1k | 1.3k | 800 |
| Mar | 4.4k | 3.3k | 1.9k | 1.5k | 900 |
| Apr | 5.1k | 3.1k | 2.4k | 1.4k | 1.1k |
| May | 5.3k | 3.5k | 2.6k | 1.7k | 1k |
| Jun | 5.8k | 3.7k | 2.5k | 1.9k | 1.2k |
Table view
Every chart carries its data as a table for screen readers. A card with a table adds a header toggle that swaps chart and table at the same height.
Revenue
| month | Revenue | Expenses |
|---|---|---|
| Jan | 32k | 18k |
| Feb | 41k | 22k |
| Mar | 38k | 27k |
| Apr | 47k | 24k |
| May | 44k | 30k |
| Jun | 52k | 28k |
| Jul | 49k | 34k |
| Aug | 55k | 31k |
| Sep | 51k | 36k |
| Oct | 46k | 33k |
| Nov | 53k | 38k |
| Dec | 58k | 35k |
Keyboard interactions
The plot is focusable, so the chart works without a pointer.
- TaborShift+Tab
- Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge.
- ArrowRightorArrowLeft
- Moves to the next or previous category. The tooltip follows, and a live region announces the one you are on. The first press starts at the first one (Left: the last one).
- HomeorEnd
- Jumps to the first or last category.
- Shift+ArrowRightorShift+ArrowLeft
- Extends a selected range from the point you started on. A range is only selected when is set.
- Escape
- Clears the active point and the selected range.
- EnterorSpace
- On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on.
On the horizontal variants and the top-k list the categories run top to bottom, so Up and Down walk them instead of Left and Right.
Behavior and motion
What the chart does on its own and what the page decides.
- Bar width
- Bar width follows the band (43 percent for a single series). You can cap it and override the corner radius.
- Variants set the look
- The variant picks the fill (solid, stroke, gradient, dashed, pattern), the shape (lollipop, capsule, track, segmented, tick), the direction and what the bar says (labels, threshold, highlight).
- Threshold and highlight
- The threshold bar keeps bars at or above the threshold in their colour and turns the others grey. The highlighted bar draws one bar (the last by default) in a highlight colour (blue by default).
- Top-k
- Top-k keeps the largest categories (6 by default) and adds the rest into one bar, named Others with the count unless you set a label.
- Legend and layout
- A series switched off in the legend keeps its slot and fades, so the groups do not jump.
- Texture and ghost trail
- A texture replaces the grid, never adds to it, and only one decorative layer goes on a chart (no texture with a pattern or a glow). The ghost trail draws last period faint behind the current one and morphs with the data.
- Hero variants
- 3d-bar and square-bar are named hero variants: glass blocks lit from above with their sides turned to the middle of the chart (gradients only, no filter), and bars built from 2 px-spaced squares that keep their true length. Never a default and never in a dense dashboard.
- New period
- New data morphs: the bars grow or shrink to their new values, and a new number of bars (12 months to 30 days, a new time bucket) is resampled onto the new slots instead of replaying the enter sequence.
- Legend on small cards
- In a ChartCard under 560 px the legend keeps to one row: the badges that fit, then a +n button that opens the rest.
- Loading, empty and error
- The chart keeps its size while it loads, is empty or fails, so the card never jumps. Loading shows a skeleton; error adds a Try again button when a retry handler is set.
- Legend
- A ChartCard shows series as badges. With two or more series each badge switches its series off, the last visible one stays on, and a legend of roles can be made static.
- Data table
- The chart also renders its data as a table for screen readers, in plot order. A ChartCard can show that table on screen through a toggle that keeps the card height.
- Size
- The chart fills its container's width; you set the plot height. Text never scales: labels keep their size at every width.
Motion
The enter sequence and the hover follow the motion tokens of the library.
- Grow
- Bars grow from the zero line the first time the chart is in view, and again after loading or when new data arrives. You can turn the animation off.
- Hover
- The muted band behind the active category moves with the pointer or the arrow keys.
- Reduced motion
- With reduced motion on, the enter sequence is off and the chart appears at once. Tooltip, crosshair and every state still work.
Anatomy
BarChart draws columns or horizontal bars from one shared plot. Variants cover grouped and stacked looks, lollipop, capsule, butterfly and top-k with Others; bars always stand on zero.
Revenue
| month | Revenue | Expenses |
|---|---|---|
| Jan | 32k | 18k |
| Feb | 41k | 22k |
| Mar | 38k | 27k |
| Apr | 47k | 24k |
| May | 44k | 30k |
| Jun | 52k | 28k |
| Jul | 49k | 34k |
| Aug | 55k | 31k |
| Sep | 51k | 36k |
| Oct | 46k | 33k |
| Nov | 53k | 38k |
| Dec | 58k | 35k |
- 1
Takes data, an index and series. Bar width follows the band (43 percent for a single series); you can cap it, override the corner radius, or fill bars with a pattern in the series colour.
- 2data-slot="chart-plot"
The focusable region. Left and Right (Up and Down on horizontal variants) walk the categories, Home and End jump, Shift with an arrow selects a range when a range handler is set.
- 3data-slot="chart-grid"
Horizontal grid lines and a left value axis for columns. Horizontal variants and the top-k list get vertical grid lines, a bottom value axis and a left category axis sized to the longest label.
- 4data-slot="chart-marks"
One rounded bar per series and category, growing from the zero line. A negative value hangs below it; a series switched off in the legend keeps its slot and fades, so groups do not jump.
- data-slot="chart-values"Optional
Numbers at the bar ends for labelled bars, top-k and butterfly, or anywhere when values are shown. When they all fit they all show; if not, only the hovered or focused category gets one.
- data-slot="chart-threshold"Optional
The threshold bar has a dashed line with a tag, such as Target 30k. Bars at or above the threshold keep their colour and the others turn grey.
- data-slot="chart-butterfly"Optional
The two-sided butterfly layout: the first series grows left, the second right, with the category name in a column between them.
- data-slot="chart-tracks"Optional
The pale full-height capsule behind each bar of the track bar, showing how far the bar is from the top of the scale.
- 5data-slot="chart-tooltip"Optional
Hovering or focusing a category lights a muted band behind it and opens the tooltip with one row per visible series. The change chip compares with the previous category.
- data-slot="chart-message"Optional
The skeleton is muted columns (or rows on horizontal variants) shaped like the real data, under the shimmer. Empty and error messages replace the bars; the error offers Try again.
Every category and series as a screen-reader table, and a live region that announces the active category with all its values.
- data-slot="chart-ghost"
Best practices
- Do
Pick the orientation from the labels. Long category names such as plan or region names belong on a horizontal variant, where the left axis grows to fit them instead of rotating or cutting text.
- Do
Keep grouped bars to three series. More makes each bar too thin to hover; switch to a horizontal variant or small multiples.
- Do
Add a pattern when the chart is printed or colour alone is not enough: one pattern form per chart (stripes or dots) for every series, which stay apart by their colour. Patterned bars are at least 20 px wide; on narrow charts neighbouring categories are gathered first.
- Do
Annotate with props instead of drawing on top: forecastFrom (striped forecast bars and an Actual / Forecast legend via forecastLegendItems), trendline, events (icon buttons with a tooltip, a counter for several at one index) and range (grey stripes behind the bars).
- Don’t
Don't start the value axis above 0. Bar length is the value, so a cropped baseline exaggerates differences; use LineChart or RangeBarChart when the interesting part is the narrow band.
- Don’t
Don't sort the top-k chart by hand and then pass every row. Set the top count and let the rest collapse into the Others bar, so the list stays at six or seven rows.
API reference
One table for BarChart. It is a plain component, so the table lists every prop; the ChartCard around it takes its own props, and the chart works without one.
Takes data, an index and series. Bar width follows the band (43 percent for a single series); you can cap it, override the corner radius, or fill bars with a pattern in the series colour.
| Prop | Type | Default | Description |
|---|---|---|---|
| data required | readonly ChartDatum[] | — | One object per category / point. |
| index required | string | — | Field holding the category label (x axis; y axis for horizontal bars). |
| series required | readonly ChartSeries[] | — | The series to draw, in order. |
| variant | "basic-bar" | "grouped-bar" | "stroke-bar" | "gradient-bar" | "dashed-bar" | "duotone-bar" | "stripped-bar" | "horizontal-bar" | "negative-bar" | "lollipop" | "labelled-bar" | "threshold-bar" | "top-k-with-others" | "butterfly-chart" | "track-bar" | "capsule-bar" | "highlighted-bar" | "segmented-bar" | "grouped-bar-3-series" | "mirrored-bar" | "dense-bar" | "horizontal-grouped-bar" | "tick-bar" | "3d-bar" | "square-bar" | "basic-bar" | Figma variant. Default . |
| valueFormatter | ChartValueFormatter | — | Values in tooltip, labels, table and live region. Default: 42000 → "42k". |
| label | string | — | Accessible name, e.g. the card title. |
| height | number | — | Fixed height of the plot frame in px. Without it the height follows the width (, , ): 220 px on a phone, up to 434 px (the plot of the Figma large card) from about 1130 px wide. |
| state | "ready" | "loading" | "empty" | "error" | — | shows the chart-shaped skeleton, and a message in the plot. |
| hiddenSeries | readonly string[] | — | Series keys that are switched off (legend toggle): drawn faded, dimmed in the tooltip. |
| pattern | ChartPattern | readonly ChartPattern[] | — | Fill the bars with a pattern instead of the variant's fill. One pattern form per chart (owner, Nov 12 2026): every series takes the same form — stripes or dots — and the series stay apart by colour only. A list is still accepted for older… |
| threshold | number | — | : bars at or above it keep their colour, the others turn grey. |
| highlightIndex | number | — | : the emphasised category (default: the last one). |
| topK | number | 6 | : how many categories keep their own bar (default 6); the rest are summed. |
| activeIndex | number | null | — | The active point (hovered or focused) as an index into , to control it yourself. shows none. |
| aggregate | ChartAggregate | Readonly<Record<string, ChartAggregate>> | — | Bars on a time axis () that would get thinner than 6 px are gathered into weeks, months, quarters or years (, the default). How a bucket sums up each series: (default), or — one for all… |
| animate | boolean | — | Enter sequence (draw, wipe, grow) on scroll into view, after loading and on new data. Default true; off with reduced motion. |
| animationKey | string | number | — | Change it to play the enter sequence again (e.g. ). New replays it by itself. |
| aspectRatio | number | — | Width ÷ height when is not set. Default 2.6. |
| axisFormatter | ChartValueFormatter | — | Value-axis labels; defaults to . |
| barWidth | number | — | Maximum bar width (thickness for horizontal bars) in px. |
| categoryAxis | boolean | — | Category-axis labels (default true). |
| categoryFormatter | (label) => string | — | Shortens category labels on the axis, e.g. "Mar 12" → "Mar"; tooltip and pill keep the full label. |
| categoryTicks | readonly string[] | — | Only these category labels are shown on the axis (the rest stay hoverable). |
| defaultActiveIndex | number | null | — | The point that is active at first, for an uncontrolled chart. It shows the tooltip without a pointer. |
| defaultSelectedRange | ChartRange | null | — | The range that is selected at first, for an uncontrolled chart. |
| description | string | — | Screen-reader summary; generated from the data when omitted. |
| emptyDescription | string | — | Text under the title in the empty state. |
| emptyTitle | string | — | Title of the message in the empty state. |
| errorDescription | string | — | Text under the title in the error state. |
| errorTitle | string | — | Title of the message in the error state. |
| events | readonly ChartEvent[] | — | Event markers: a dotted line over the plot and a round icon button above it; several at one index get a counter badge. |
| forecastFrom | number | — | Index of the first forecast category. From there a dashed divider with a label ("Forecast from Oct"); lines turn dotted and end on a dot, areas fill with stripes, bars are striped with a rim in the series colour. |
| forecastLabel | string | — | Label of the forecast divider. Default "Forecast from <category>" (on small charts "Forecast"). |
| ghost | string | ChartGhost | — | The previous period as a faint ghost behind one series: a field name, or . Bars get a faint dashed column behind each bar. The tooltip lists it under its series, the table adds a column; give the legend item for a faint ring. |
| grid | boolean | — | Grid lines (default true). |
| gridFade | boolean | — | The grid fades out towards both ends (default true). |
| gridIntervals | number | — | Number of equal grid intervals. Default: one per 44 px of plot height, capped by the size class (xs 2, sm 3, md 3, lg 4, xl 5). |
| gridStyle | "solid" | "dashed" | — | Grid lines are dashed 4 / 4 by default; draws them through. |
| highlightColor | "indigo" | "blue" | "purple" | "green" | "orange" | "pink" | "yellow" | "red" | "grey" | "blue" | : colour of the emphasised bar. Default blue. |
| includeZero | boolean | — | The value axis starts at 0 (owner rule, default). fits the data (prices, temperatures). |
| maxHeight | number | — | Highest height from . Default 434. |
| minHeight | number | — | Lowest height from . Default 220. |
| negativeColor | "indigo" | "blue" | "purple" | "green" | "orange" | "pink" | "yellow" | "red" | "grey" | "red" | : colour of bars below zero. Default red. |
| onActiveIndexChange | (index) => void | — | Called with the index when the pointer or the arrow keys move to another point, and with when they leave. Use it to show the hovered value in a headline. |
| onRetry | () => void | — | Shows a Try again button in the error state and calls this when it is pressed. |
| onSelectedRangeChange | (range) => void | — | Called when a drag across the plot or Shift with an arrow key changes the range, and with when Escape or a click clears it. |
| othersLabel | string | — | : label of the summed bar. Default "Others (n)". |
| radius | number | — | |
| range | ChartRangeHighlight | — | A highlighted range of categories with grey stripes behind the marks and an optional label. |
| rangeSelectable | boolean | — | Allow selecting a range by dragging or Shift + arrow keys. On when is set. |
| resolution | "auto" | "full" | — | (default): lines and areas draw at most 1.5 points per pixel (LTTB; hover and tooltip keep every point), and bars on a time axis that would get thinner than they may are gathered into weeks, months … draws every point and eve… |
| segmentColors | "shades" | "series" | "shades" | : colours of the three value tiers (lower, middle and upper third of the axis), bottom to top. (default): three steps of the series colour, dark → medium → light. : indigo, pink and blue from the standard or… |
| selectedRange | ChartRange | null | — | The selected range as inclusive indices into , to control it yourself. selects nothing. |
| showValues | boolean | — | Value labels at the bars (on by default for labelled, top-k and butterfly). |
| texture | "dots" | "diagonal" | "grid" | — | , or : a quiet background texture in place of the grid lines (never both), in the grid colour and faded at all four edges; the zero line stays. |
| thresholdLabel | string | — | Label of the threshold tag. Default "Target <value>". |
| tooltip | boolean | — | Tooltip on hover / keyboard focus. Default true. |
| tooltipTitle | (datum, index) => ReactNode | — | Title line of the tooltip; defaults to the category label. |
| trendline | boolean | readonly string[] | — | Linear trend (least squares), dotted in a lighter step of the series colour: for every series or a list of series keys. |
| valueAxis | boolean | — | Value-axis labels (default true). Off for compact cards and sparkline-like plots. |
| valueAxisPlacement | "auto" | "outside" | "inside" | — | Where the value labels go: left of the plot, in the plot above their grid lines (saves the label column on narrow charts). (default) puts them left of the plot at every size; is opt-in. |
| valueAxisSide | "left" | "right" | — | Side of the value axis (vertical charts). is the price axis of trading charts. |
| valueDomain | readonly [number, number] | — | Fix the value domain instead of fitting it to the data (still rounded to nice steps). |
| valueTicks | readonly number[] | — | Exact value-axis ticks (ascending), e.g. [0, 10000, … 70000]; replaces the nice-step domain. |
| width | number | — | Fixed width instead of filling and measuring the container. |
| xScale | "band" | "time" | — | (default): the categories sit side by side in equal bands. : the field holds dates (Date, ms or a string such as "2026-03-01"); points sit at their real distance, the axis picks its tick level (hours → days → weeks → m… |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("bar-chart")The full library index for assistants is at /llms.txt.
Related components
Stacked chart, 12 points from Jan to Dec. Direct from $14.0k to $27.0k, lowest $14.0k, highest $27.0k; Organic from $10.0k to $17.0k, lowest $10.0k, highest $17.0k; Referral from $5.0k to $11.0k, lowest $5.0k, highest $11.0k. Stacked Charts, data table month Direct Organic Referral Jan $14.0k $10.0k $5.0k Feb $18.0k $11.0k $7.0k Mar $16.0k $10.0k $6.0k Apr $20.0k $14.0k $8.0k May $19.0k $13.0k $7.0k Jun $23.0k $15.0k $9.0k Jul $21.0k $14.0k $8.0k Aug $25.0k $16.0k $10.0k Sep $22.0k $15.0k $9.0k Oct $20.0k $13.0k $8.0k Nov $24.0k $16.0k $10.0k Dec $27.0k $17.0k $11.0k Charts13 stylesProStacked ChartStacked chart for the parts of a total: stacked and 100 % columns, stacked areas, diverging Likert bars, Marimekko and gapped rows.Line chart, 12 points from Jan to Dec. Revenue from $32.0k to $58.0k, lowest $32.0k, highest $58.0k; Expenses from $18.0k to $35.0k, lowest $18.0k, highest $38.0k. Revenue and expenses, data table month Revenue Expenses Jan $32.0k $18.0k Feb $41.0k $22.0k Mar $38.0k $27.0k Apr $47.0k $24.0k May $44.0k $30.0k Jun $52.0k $28.0k Jul $49.0k $34.0k Aug $55.0k $31.0k Sep $51.0k $36.0k Oct $46.0k $33.0k Nov $53.0k $38.0k Dec $58.0k $35.0k Charts27 stylesProLine ChartLine chart for trends over time: smooth lines (straight on request) and stepped lines, comparisons, bands, forecasts and thresholds, with tooltip, keyboard navigation and a data table.Range bar chart, 12 categories from Jan to Dec. Range from -6 °C to 30 °C. Temperature range per month, data table month Low High Jan -6 °C 6 °C Feb -5 °C 8 °C Mar -1 °C 12 °C Apr 4 °C 18 °C May 9 °C 24 °C Jun 13 °C 28 °C Jul 14 °C 30 °C Aug 13 °C 28 °C Sep 9 °C 24 °C Oct 4 °C 18 °C Nov -1 °C 12 °C Dec -5 °C 8 °C Charts5 stylesProRange Bar ChartRange bar chart for a span per category — minimum to maximum, planned against actual, as dumbbells or as gradient bars.