Prodular UI

Bar list

Ranked horizontal bars with the label on the bar and the value on the right. For top sources, pages, countries or customers.

npx prodular-ui add bar-list

Top sources

Icons, column headers, each row's share of the total and Show more after five rows.

Signups by source, last 30 days
42,340
SourceVisitors
  • Google search43.5%18,420
  • Direct22%9,310
  • ChatGPT and other assistants14.5%6,140
  • Partner referrals9.2%3,880
  • Product newsletter5.2%2,210

Selectable rows

With onValueChange the rows become buttons. activeKey marks the selected one, here driving the card title.

Revenue by customer, Q3
Northwind Logistics

Loading and empty

Skeleton bars while data loads and a quiet message when there is none.

Loading

Empty

No signups in this period

Anatomy

<BarList  data={[{ name: "Google search", value: 18420 }]}  label="Source"  valueLabel="Visitors"  limit={5}/>

Guidance

Use it when

  • Rankings of one measure across many categories: top pages, sources, countries, customers.
  • Next to a chart in a dashboard card, for the breakdown behind a headline number.
  • onValueChange when picking a row filters the rest of the page.

Avoid

  • Values over time. Use Chart with an area or line.
  • Comparing two measures per row. Use a table or a grouped bar chart.
  • Negative values. Bars grow from the left only.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Pass data as { name, value }[] and let sortOrder sort it. Keep sortOrder="none" only when the order means something, like funnel steps.
  • Format values with valueFormatter (currency, percentages), never by passing strings as value.
  • Use limit={5} for long lists so the card keeps its height. Show more expands in place.
  • Set color to a chart token, var(--chart-N), never a hex value.
  • Show loading while data is fetched and pass empty with a sentence that names the period.

API

BarList

PropTypeDefaultDescription
data{ name, value, key?, href?, icon?, color? }[]Rows. The longest bar is the largest value.
valueFormatter(value: number) => ReactNodeFormats the value on the right.
sortOrder"descending" | "ascending" | "none""descending"How rows are ordered.
showSharebooleanfalseAdds each value's percent of the total.
limitnumberRows shown before Show more.
onValueChange(item) => voidMakes rows buttons.
activeKeystringKey of the selected row.
colorstring"var(--chart-1)"Bar color for every row.
loadingbooleanfalseShows skeleton bars.
label / valueLabelReactNodeColumn headers over labels and values.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add bar-list# or, with the registry in components.jsonnpx shadcn@latest add @prodular/bar-list

Used in these screens