# Bar List

> A ranked list of top pages, referrers or countries whose rows slide to their new rank and resize when you switch lists.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Blocks › Charts |
| Live preview | https://uibrik.com/components/bar-list |
| Writes | 1 files into `components/uibrik/bar-list/`, plus `components/uibrik/_charts/chart-kit.tsx` |
| Packages | `@number-flow/react`, `@tabler/icons-react`, `motion`, `react-use-measure` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 9, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/bar-list.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/bar-list`.

Can't run commands? https://uibrik.com/components/bar-list/prompt-full.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { BarList } from "@/components/uibrik/bar-list/bar-list";

const groups = [
  {
    value: "pages",
    label: "Pages",
    items: [
      { label: "/", value: 8420 },
      { label: "/pricing", value: 3910 },
      { label: "/docs/install", value: 2675 },
      { label: "/blog/launch-week", value: 1840 },
      { label: "/docs/theming", value: 1215 },
      { label: "/changelog", value: 960 },
      { label: "/components/button", value: 712 },
      { label: "/about", value: 405 },
      { label: "/careers", value: 268 },
    ],
  },
  {
    value: "referrers",
    label: "Referrers",
    items: [
      { label: "Google", value: 7630 },
      { label: "Direct", value: 4120 },
      { label: "github.com", value: 3285 },
      { label: "x.com", value: 1950 },
      { label: "news.ycombinator.com", value: 1410 },
      { label: "reddit.com", value: 782 },
      { label: "linkedin.com", value: 516 },
      { label: "DuckDuckGo", value: 304 },
    ],
  },
  // …1 more
];

<BarList
  title="Top sources"
  limit={6}
  showShare={false}
  accent=""
  groups={groups}
  unit="visitors"
  onSelect={(item) => {}}
  // items={[{ label: "…", value: 0 }]}
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/bar-list.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `title` | `string` | `"Top sources"` | Names the list. |
| `limit` | `number` | `6` | Rows shown before the rest fold into Other. |
| `showShare` | `boolean` | `false` | Show each row's share of the total. |
| `accent` | `string` | `""` | Bar colour. Empty uses the chart palette. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `groups` | `{ value: string; label: string; items: { label: string; value: number; href?: string }[] }[]` |  | Lists to switch between, each with its own tab. |
| `items` | `{ label: string; value: number; href?: string }[]` |  | A single list. Replaces groups and hides the tabs. |
| `unit` | `string` | `"visitors"` | What the headline counts. |
| `format` | `Intl.NumberFormatOptions` | `{}` | Formats every number, e.g. { notation: "compact" }. |
| `onSelect` | `(item: BarListItem) => void` |  | Makes rows buttons and is called with the chosen item. |
| `className` | `string` |  | Classes for the outer shell. |

## Where it fits

- **Top pages and referrers**: Ranked rows with proportional bars make the head of a long list easy to read in analytics. Pairs with [Funnel](https://uibrik.com/components/funnel.md) (Pro).
- **Leaderboards**: Rows slide to their new rank when the data changes, so movement up and down the board is visible. Pairs with [Gravity Sort](https://uibrik.com/components/gravity-sort.md) (Pro).
- **Sales by product or region**: Switching lists animates sizes and order instead of redrawing, which helps compare one breakdown with the next. Pairs with [Split Bar](https://uibrik.com/components/split-bar.md).

## Same shelf: Charts

- [Cohort Retention](https://uibrik.com/components/cohort-retention.md): Weekly retention as the classic triangle: a row per signup cohort, a column per week, each cell shaded by the share still active. Cells fill in a diagonal wave as the weeks unlock. Above, the chosen cohort's curve draws against the dashed average and morphs to each new cohort. Hovering a cell crosses its row and week and reads the users kept and the gap to average; cells switch between shares and user counts.
- [Flame Graph](https://uibrik.com/components/flame-graph.md) (Pro): A CPU profile as a flame graph: a row per call depth, each frame as wide as the time spent in it. Rows wipe in from the root down. Clicking a frame zooms it to the full width while its callers stay on top as crumbs, with no text stretching; hovering lights every call to the same function and reads its total and self time. Below, the functions with the most self time jump straight to their frame. App code takes the accent, libraries stay neutral and native code takes a second hue, all shaded by how hot they run.
- [Flow Chart](https://uibrik.com/components/flow-chart.md) (Pro): A Sankey of flows between columns: point at a node or ribbon to light its whole path while the rest recede.
- [Funnel](https://uibrik.com/components/funnel.md) (Pro): A conversion funnel whose drop-off between steps reads as a slope you can hover, with every step's share of the start.
- [Heatmap Rank](https://uibrik.com/components/heatmap-rank.md) (Pro): An activity heatmap that turns into a ranking, where each row's day cells slide together into one bar and the bars sort by total, and that drills down: a day cell opens into hour tiles, an hour opens into its commits.
- [Live Line](https://uibrik.com/components/live-line.md) (Pro): A realtime line that scrolls smoothly as samples stream in, and freezes under the pointer so you can read any moment.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/bar-list/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
