# Bar list

A ranked list of names with values and proportional bars; names may link.

- Family: charts
- Import: `import { BarList } from "@senvenli/react/charts";`
- Page: https://design.senvenli.com/docs/components/bar-list
- JSON: https://design.senvenli.com/docs/components/bar-list.json

## Example: Top products

The five largest, with the rest behind "Show all".

```tsx
import { BarList } from "@senvenli/react/charts";

const PRODUCTS = [
  { name: "Ergonomic chair", value: 61900 },
  { name: "Standing desk, oak", value: 48200 },
  { name: "Monitor arm, dual", value: 23400 },
  { name: "Desk lamp", value: 12800 },
  { name: "Cable tray", value: 7600 },
  { name: "Footrest", value: 5100 },
  { name: "Desk mat", value: 3900 },
];
const usd = new Intl.NumberFormat("en", { style: "currency", currency: "USD", maximumFractionDigits: 0 });

export default function Example() {
  return <BarList title="Revenue by product" period="March 2026" data={PRODUCTS} valueFormatter={usd.format} />;
}
```

## Examples

### With links

Each name opens its record; `limit` sets how many rows show first.

```tsx
import { BarList } from "@senvenli/react/charts";

const PAGES = [
  { name: "/pricing", value: 18420, href: "#pricing" },
  { name: "/features", value: 12960, href: "#features" },
  { name: "/blog/launch-notes", value: 9310, href: "#launch-notes" },
  { name: "/docs/getting-started", value: 7745, href: "#getting-started" },
  { name: "/customers", value: 4120, href: "#customers" },
];
const count = new Intl.NumberFormat("en");

export default function Example() {
  return <BarList title="Most visited pages" period="Last 30 days" data={PAGES} limit={3} valueFormatter={count.format} />;
}
```

## Guidelines

### When to use it

- The top items by a value: products, pages, regions.

### Use something else when

- [bar-chart](https://design.senvenli.com/docs/components/bar-chart.md): Values are compared over periods.

## Accessibility

Built in:

- A "Show as table" button shows the same data as a table, which screen readers get by default.

You provide:

- A title that says what the figure is.

## API reference

### BarList

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| title | `string` |  | no | What the chart shows, over it; leave it out when a card or a heading already says so. |
| aria-label | `string` |  | no | Names the chart when it has no visible `title` (a card's heading already says what it shows). |
| period | `string` |  | no |  |
| isLoading | `boolean` |  | no |  |
| emptyState | `React.ReactNode` |  | no | Shown instead of the plot when there is no data: an `EmptyState size="small"` or text; "No data" by default. |
| data | `readonly BarListDatum[]` |  | yes |  |
| valueFormatter | `ChartValueFormatter` | `plain` | no |  |
| limit | `number` | `5` | no | The rows shown before "Show all": five by default, ten at most. |

### Tokens it reads

`--ds-background-brand-subtle`, `--ds-background-neutral`, `--ds-background-neutral-pressed`, `--ds-background-selected-hovered`, `--ds-background-selected-pressed`, `--ds-border`, `--ds-border-bold`, `--ds-border-focused`, `--ds-chart-1`, `--ds-chart-2`, `--ds-chart-3`, `--ds-chart-4`, `--ds-chart-5`, `--ds-chart-neutral`, `--ds-icon-danger`, `--ds-icon-success`, `--ds-icon-warning`, `--ds-link`, `--ds-radius-medium`, `--ds-radius-small`, `--ds-radius-xsmall`, `--ds-shadow-overlay`, `--ds-space-050`, `--ds-space-075`, `--ds-space-100`, `--ds-space-150`, `--ds-space-200`, `--ds-space-300`, `--ds-space-400`, `--ds-surface-overlay`, `--ds-surface-raised`, `--ds-text`, `--ds-text-danger`, `--ds-text-subtle`, `--ds-text-subtlest`, `--ds-text-success`

## Related

- [bar-chart](https://design.senvenli.com/docs/components/bar-chart.md)
- [donut-chart](https://design.senvenli.com/docs/components/donut-chart.md)
