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
| day | High | Low |
|---|---|---|
| Feb 1 | 240 | 180 |
| Feb 2 | 321 | 157 |
| Feb 3 | 319 | 192 |
| Feb 4 | 314 | 193 |
| Feb 5 | 319 | 152 |
| Feb 6 | 245 | 177 |
| Feb 7 | 274 | 113 |
| Feb 8 | 259 | 125 |
| Feb 9 | 266 | 152 |
| Feb 10 | 322 | 154 |
| Feb 11 | 305 | 228 |
| Feb 12 | 361 | 204 |
| Feb 13 | 350 | 210 |
| Feb 14 | 315 | 209 |
Floating capsules that span each period's low to its high.
npx shadcn@latest add ikislay/pixel-ui/range-chartimport { RangeChart } from "@/components/ui/range-chart"const data = [{ day: "Mon", min: 120, max: 210 },{ day: "Tue", min: 140, max: 260 },{ day: "Wed", min: 90, max: 180 },]export function Demo() {return <RangeChart label="Daily active range" data={data} index="day" low="min" high="max" />}
1// Loading…
Options you can pass to customize this component.
data*Record<string, string | number>[]One object per period along the x axis.
index*stringThe key in each object that labels the x axis.
low*stringThe key that holds the bottom of each span.
high*stringThe key that holds the top of each span.
lowLabelstringNames the bottom value in the tooltip.
highLabelstringNames the top value in the tooltip.
label*stringNames the chart for screen readers and captions its data table.
heightnumberHeight in pixels. The width fills the parent.
format(value: number) => stringFormats values wherever the chart shows them. Defaults to short numbers like 12.4K.
colorstringAny CSS color for the capsules.
classNamestringMerged onto the root element.