Skip to content
Thrum

Bar list

Ranked rows, each with a name, a bar to a shared scale and a formatted value: top pages, top referrers, busiest endpoints. Rows can be links or buttons, and a long list folds behind “Show all”. For values over time, use the bar chart.

Install

npx shadcn@latest add @thrum-pro/bar-list

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Data shape

Type
type BarListItem = {
  key?: string;         // default: name
  name: string;
  value: number | null; // null = no data, sorted last
  href?: string;        // the row becomes a link
};
Sample
[
  { name: "/pricing", value: 8420 },
  { name: "/docs/install", value: 6115 },
  { name: "/blog", value: 2390 },
  { name: "/changelog", value: null },
]

Props

PropTypeDefaultDescription
datareadonly BarListItem[]RequiredThe rows, in any order.
labelstringRequiredWhat the list ranks. Names the list for screen readers.
sort"descending" | "ascending" | "none"Default "descending"Order of the rows by value. none keeps the order of data. Missing values always go last; equal values keep their order.
maxnumber–Rows shown before a “Show all” button. Leave out to show every row.
formatIntl.NumberFormatOptionsDefault compactHow values are written.
localestringDefault "en-US"Locale for number formatting.
colorstringDefault var(--chart-1)Any CSS colour for the bars.
onSelect(item: BarListItem) => void–Makes every row without an href a button, called with the picked row.
soundbooleanDefault truePlay a soft click when a row button is picked, if the visitor has sound on. Links are silent.
emptyLabelstringDefault "No data"Text shown when there are no rows.
classNamestring–Merged onto the root. It fills the width it is given.

Motion and sound

Motion

  • First draw: each bar grows from zero in 250 ms. Bars start 40 ms apart, and the whole entrance takes 550 ms at most however many rows there are.
  • New values: each bar moves to its new length in 400 ms with no overshoot. Rows that “Show all” reveals appear at their length.
  • Reduced motion: every bar appears at its length at once.

Sound

  • A soft click when a row button is picked. Links and “Show all” are silent.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • The rows are a list named by the label, so a screen reader announces how many rows there are and reads each name with its value.
  • Bars are hidden from screen readers: the value is in the text. A long name is cut with an ellipsis and its full text is the row's title.
  • “Show all” is a button with aria-expanded that controls the list. Its text says how many rows there are.
  • Rows that are links or buttons are 36 px tall and show the focus ring. It is a list, not a chart, so it has no reading cursor.
KeysAction
TabMove to the next row link or button, then to “Show all”. Plain rows are not tab stops.
EnterFollow the link, or pick the row.
SpacePick the row, or show or fold the rest of the list.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/bar-list.tsx
Packages
motion
Brings along
Chart foundationsMotion tokensSound engineButton

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor