# BarChart

> A handful of figures side by side as bars, with a label under each: grey, and green for the one that matters now. For months, not for analysis.

| | |
|---|---|
| Kind | component |
| Contract | `review` · [bar-chart.contract.yaml](https://github.com/Runceanu/rost/blob/master/contracts/bar-chart.contract.yaml) |
| Guidance | `proposed` |
| Source | [Figma 749:23](https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=749-23) · read 2026-11-17 · frozen 2026-11-17 |
| Implemented in | nowhere yet |

## Install

It lands in `src/rost/bar-chart/`, with what it needs and its contract:

```sh
npx github:Runceanu/rost add bar-chart
```

Then import `src/rost/fonts.css` and `src/rost/tokens.css` once, at the root of the app. More on this in [Install](https://rost.build/docs/install.md).

## Props

| Prop | Type | Values | Default |
|---|---|---|---|
| `data` | node |  |  |
| `current` | number |  |  |
| `max` | number |  |  |
| `height` | number |  | `160` |
| `label` | string |  |  |

## Anatomy

- `root`: An `<ol>`, one item per bar, side by side and sharing the width, 8px apart. Its height comes from the `height` prop.
- `item`: An `<li>`: the bar's room, then its label, 8px apart.
- `plot`: The room a full bar would take. The bar stands at its bottom.
- `bar`: A bar, as tall as its value out of `max`, in a field's edge grey, with 4px corners on top.
- `current-bar`: The bar for now: the same shape, in the primary green.
- `label`: Under each bar, centred, in label type and the tertiary grey.
- `current-label`: The label for now, medium weight in the main text colour.

## When to use

- **How this month compares.** Income for the last six months, with this one in green. The Stat above it says the number; the bars say whether it's up.

## When not to use

- **Many bars.** Past about twelve the labels don't fit and the bars blur. Use a **Table**.
- **Exact comparisons.** Bars without an axis show shape, not amounts. When the amounts matter, write them.

## Behaviour

Each bar's height is its value out of `max`, which is the largest value unless you set it. It has no axis, gridlines or tooltips, on purpose.

## Accessibility

- **Element**: `<ol>` with an `aria-label`, so it's read as a list of so many items. Each `<li>` says its label and value in words.
- **Name**: `label`: what the chart shows, like Income by month.
- **Colour**: The grey bars are 4.3:1 on the dark page and the green one 10:1. The current label is also heavier, so the colour isn't the only sign.

## Content

Short labels, like Jun or Q3. Give `valueText` in the units people read, like €1,200.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `bar-chart/bar` | `#747573` |
| `bar-chart/current` | `#00d669` |
| `bar-chart/current-label` | `#ededed` |
| `bar-chart/label` | `#999999` |
| `font-family/base` | `'General Sans Variable'` |
| `spacing/gap/none` | `0px` |
| `spacing/gap/small` | `8px` |
| `spacing/radius/xsmall` | `4px` |
| `typography/label/font-size` | `12px` |
| `typography/label/font-weight/medium` | `500` |
| `typography/label/font-weight/regular` | `400` |
| `typography/label/letter-spacing` | `0px` |
| `typography/label/line-height` | `14px` |

See it live, with every value of every variant: [rost.build/components/bar-chart/](https://rost.build/components/bar-chart/)
