Controls

Range Chart

Effect
Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Range Chart

Daily active users, lowest to highest
dayHighLow
Feb 1240180
Feb 2321157
Feb 3319192
Feb 4314193
Feb 5319152
Feb 6245177
Feb 7274113
Feb 8259125
Feb 9266152
Feb 10322154
Feb 11305228
Feb 12361204
Feb 13350210
Feb 14315209

Range Chart

Floating capsules that span each period's low to its high.

Installation

npx shadcn@latest add ikislay/pixel-ui/range-chart

How to use

import { 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" />
}

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
data*
Record<string, string | number>[]

One object per period along the x axis.

index*
string

The key in each object that labels the x axis.

low*
string

The key that holds the bottom of each span.

high*
string

The key that holds the top of each span.

lowLabel
string

Names the bottom value in the tooltip.

highLabel
string

Names the top value in the tooltip.

label*
string

Names the chart for screen readers and captions its data table.

height
number

Height in pixels. The width fills the parent.

format
(value: number) => string

Formats values wherever the chart shows them. Defaults to short numbers like 12.4K.

color
string

Any CSS color for the capsules.

className
string

Merged onto the root element.