Bar List
A ranked list of labeled values with proportional bars, for top pages, referrers, and breakdowns.
Overview
A bar list ranks categories by value and draws a bar behind each label, so long names stay readable where a horizontal bar chart would truncate them. Use it for "top N" panels: pages, referrers, countries, devices, or error types. Prefer a Bar Chart when categories need to be compared across several series or over time.
Anatomy
BarList reads nameKey and valueKey from each row, sorts the rows, and scales every bar to the largest value or to max. Each row is a label, an optional icon, a bar, and a value. Two variants are available: tinted puts the label on a light wash of the bar color, and track puts a thin bar on a muted track under the label. The list is drawn with DOM elements rather than a canvas, so labels and values are real text.
Accessibility
The rows render as a list with real text, so screen readers read each name and value in order. Bars are decorative and hidden from assistive technology. Pass ariaLabel to name the list. With onValueChange, rows become buttons that report aria-pressed while a selectedName is set, and rows with an hrefKey value become links. Selection dims the other rows, so keep the selected value written out nearby as well.
Installation
Usage
import { BarList, type ChartConfig } from "honestui/charts";<BarList
data={data}
config={chartConfig}
nameKey="page"
valueKey="visitors"
nameLabel="Page"
valueLabel="Visitors"
/>The config entry for valueKey sets the bar color. A row whose name is also a config key takes that entry's label, icon, and colors instead, which gives each category its own color.
Examples
Track variant
Track rows suit shares of a whole: set max={1} so every bar is measured against the full width rather than the largest row. Each device here has its own config entry with an icon and color.
Selectable rows
Use onValueChange with selectedName to filter the rest of a dashboard by a row. Choosing the selected row again clears the filter in this example.
Loading State
Pass isLoading to draw neutral placeholder rows with the same loading treatment as the other Honest UI charts.