---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Bar list

A ranked list of rows, each a label, a bar for its share and its number, sorted by that number, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `BarList`.

## Try it

Switch the rows (pages that open, plans in euros, teams in their hues, long paths, a zero and a fall, none), how many it shows (the rest counted in "+N more"), the order and the holder: the bars grow in and rescale.

The pages, plans, teams and numbers are ours; the page links go nowhere.

## When to use

- A ranked list of rows, each a label, a bar for its share and its number, sorted by that number.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Bar list on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-bar-list.json --yes
```

```text
Add the Goop Bar list to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { BarList, BarListItem } from '@/components/ui/goop/bar-list';
import { Card } from '@/components/ui/goop/card';

<>
  <Card>
    <BarList
      aria-label="Revenue by plan"
      items={[
        { label: 'Business', value: 26100 },
        { label: 'Team', value: 18400 },
        { label: 'Starter', value: 7350 },
        { label: 'Hobby', value: 940 },
      ]}
      format={{ style: 'currency', currency: 'EUR', maximumFractionDigits: 0 }}
      limit={3}
    />
  </Card>
  <BarList aria-label="Top pages" hue="blue">
    <BarListItem label="Pricing" value={1480} asChild>
      <RouterLink href="/pages/pricing" />
    </BarListItem>
    <BarListItem label="Documentation" value={960} asChild>
      <RouterLink href="/pages/docs" />
    </BarListItem>
  </BarList>
</>
```

- Fits: overview (its recipe).
- Also known as: RankedList, TopList, HorizontalBarChart, Leaderboard.
- A bar list has no frame or inset of its own past its rows' 8 px: in a `Card` set it in the card's content under the CardHeader, never as a chart in a ChartContainer (that is for plotted series).
- height, width, padding, gap, corner, background, text, motion: add no class for these.

## API reference

### Options

- `items?: readonly BarListDatum[]` — The rows as data; or write them as `BarListItem` children.
- `children?: ReactNode` — The rows as `BarListItem`s (a router's links through `asChild`), read as the data is.
- `max?: number` — The value a full bar stands for; by default the largest value.
- `sort?: 'desc' | 'asc' | false = 'desc'` — The rows' order: largest first (`desc`, the default), smallest first (`asc`), or as given (`false`).
- `limit?: number` — How many rows to show; the rest are counted in a quiet "+N more" line.
- `more?: ReactNode | ((hidden: number) => ReactNode)` — The line for the rows `limit` leaves out, in place of "+N more": its words, or a function of their count.
- `format?: ((value: number) => string) | Intl.NumberFormatOptions` — How a figure reads: a function of the value, or `Intl.NumberFormat` options; by default the reader's own format.
- `locale?: string` — The numbers' locale; the document's language by default.
- `hue?: Exclude<Hue, 'orange' | 'pink'>` — Every bar's colour (a row's own `hue` wins): a hue, as a row's; by default the neutral grey.
- `empty?: ReactNode = 'No data to show.'` — The words of the small empty state shown when there are no rows.

- Types: BarListDatum = { label: string; value: number; href?: string; icon?: IconName; hue?: Exclude<Hue, 'orange' | 'pink'>; id?: string }

### Parts

- `BarListItem` — One row of a `BarList`; takes asChild; label: ReactNode — What the row counts, at its start; value: number — Its number: the list scales and sorts by it, and writes it at the row's end in its format; icon?: IconName — A pack icon before the label, by its name; hue?: Exclude<Hue, 'orange' | 'pink'> — The bar's colour, over the list's: a hue (`blue`, `green`, `yellow`, `red`, the accent `primary`, the grey `neutral`); href?: string | undefined — The row's link: the whole row opens it; children?: ReactElement — The caller's link element (with no children of its own)

- data-slot values (to select a part by): bar-list, bar-list-footer, bar-list-icon, bar-list-indicator, bar-list-item, bar-list-label, bar-list-list, bar-list-row, bar-list-track, bar-list-value

## Keyboard

- Tab: move to the next linked row
- Enter: open the focused row's link

## Accessibility

- The part itself answers the keys above.
- hover, active: the browser's own (:hover, :active): write nothing

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Card](/themes/trail/components/card): A framed surface that holds one piece of content or a list of settings rows.
- [Sparkline](/themes/trail/components/sparkline): One line of a series' shape, as wide as its caller and as tall as the text line it sits in.
- [Chart donut](/themes/trail/components/chart-donut): A donut chart that shows how one whole splits into parts, each slice read on hover, on a press or from the keyboard.
- [Chart line](/themes/trail/components/chart-line): A line or area chart of up to five levels over time, read on hover, press or keyboard.
