Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
1
A ranked list of labelled bars that fill along soft rounded tracks.
npx shadcn@latest add ikislay/pixel-ui/horizontal-bar-chartimport { HorizontalBarChart } from "@/components/ui/horizontal-bar-chart"const data = [{ label: "United States", value: 4120 },{ label: "Germany", value: 2380 },{ label: "India", value: 1960 },]export function Demo() {return <HorizontalBarChart label="Visitors by country" data={data} />}
1// Loading…
Options you can pass to customize this component.
data*{ label: string; value: number; color?: string }[]One row per entry, drawn in the order given.
label*stringNames the chart for screen readers and captions its data table.
format(value: number) => stringFormats values wherever the chart shows them. Defaults to short numbers like 12.4K.
maxnumberThe value that fills a track. Defaults to the largest value.
colorstringAny CSS color for the bars. A row's own color wins.
classNamestringMerged onto the root element.