Top products
import { BarList } from "@senvenli/react/charts";
const PRODUCTS = [
{ name: "Ergonomic chair", value: 61900 },
{ name: "Standing desk, oak", value: 48200 },
{ name: "Monitor arm, dual", value: 23400 },
{ name: "Desk lamp", value: 12800 },
{ name: "Cable tray", value: 7600 },
{ name: "Footrest", value: 5100 },
{ name: "Desk mat", value: 3900 },
];
const usd = new Intl.NumberFormat("en", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
export default function Example() {
return <BarList title="Revenue by product" period="March 2026" data={PRODUCTS} valueFormatter={usd.format} />;
}import { BarList } from "@senvenli/react/charts";Examples
With links
Each name opens its record; `limit` sets how many rows show first.import { BarList } from "@senvenli/react/charts";
const PAGES = [
{ name: "/pricing", value: 18420, href: "#pricing" },
{ name: "/features", value: 12960, href: "#features" },
{ name: "/blog/launch-notes", value: 9310, href: "#launch-notes" },
{ name: "/docs/getting-started", value: 7745, href: "#getting-started" },
{ name: "/customers", value: 4120, href: "#customers" },
];
const count = new Intl.NumberFormat("en");
export default function Example() {
return <BarList title="Most visited pages" period="Last 30 days" data={PAGES} limit={3} valueFormatter={count.format} />;
}Guidelines
When to use it
- The top items by a value: products, pages, regions.
Use something else when
- Values are compared over periods. Bar chart
Accessibility
Built in
- A "Show as table" button shows the same data as a table, which screen readers get by default.
You provide
- A title that says what the figure is.
API reference
BarList
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | – | What the chart shows, over it; leave it out when a card or a heading already says so. |
aria-label | string | – | Names the chart when it has no visible |
period | string | – | |
isLoading | boolean | – | |
emptyState | React.ReactNode | – | Shown instead of the plot when there is no data: an |
dataRequired | readonly BarListDatum[] | – | |
valueFormatter | ChartValueFormatter | plain | |
limit | number | 5 | The rows shown before "Show all": five by default, ten at most. |
titlestringWhat the chart shows, over it; leave it out when a card or a heading already says so.
aria-labelstringNames the chart when it has no visible
title(a card's heading already says what it shows).periodstringisLoadingbooleanemptyStateReact.ReactNodeShown instead of the plot when there is no data: an
EmptyState size="small"or text; "No data" by default.dataRequiredreadonly BarListDatum[]valueFormatterChartValueFormatterDefaultplainlimitnumberDefault5The rows shown before "Show all": five by default, ten at most.