BarList
A share-of-total breakdown: label, value, share and a proportional bar per row (each a role="meter").
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
A share-of-total breakdown: label, value, share and a proportional bar per row (each a role="meter").
Accessibility
Rendered as a real <table> with header scopes; sortable columns expose aria-sort. Row selection and actions are keyboard reachable.
Install and import
npx shadcn@latest add @prism/bar-list
import { BarList } from '@/components/prism/BarList';
In a no-build prototype, read it from the bundle instead: const { BarList } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
data | BarListItem[] | Yes | |
total | number | — | The denominator for each row's share. Default: the sum of the values. |
relativeTo | "max" | "total" | — | Scale bars to the largest row ("max", default) or to the total ("total"). |
sort | boolean | — | Largest first. Default true; pass false when the order means something. |
showShare | boolean | — | Show each row's share of the total as a percentage. Default true. |
formatValue | (value: number) => string | — | Formats each value. Default: locale number formatting. |
tone | "accent" | "positive" | "notice" | "negative" | "neutral" | — | |
hue | "rose" | "orange" | "amber" | "green" | "teal" | "blue" | "violet" | "magenta" | — | Paint the bar in a categorical hue (a module, a series) instead of a tone. |
className | string | — |