Controls

Pill Bar 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.

Pill Bar Chart

Focus hours by day
dayHours
Mon5.2h
Tue6.8h
Wed4.9h
Thu7.6h
Fri6.1h
Sat2.4h
Sun1.8h

Pill Bar Chart

Rounded pill bars with one bar lit and the rest softly hatched.

Installation

npx shadcn@latest add ikislay/pixel-ui/pill-bar-chart

How to use

import { PillBarChart } from "@/components/ui/pill-bar-chart"
const data = [
{ day: "Mon", hours: 5.2 },
{ day: "Tue", hours: 6.8 },
{ day: "Wed", hours: 4.9 },
]
export function Demo() {
return (
<PillBarChart
label="Focus hours by day"
data={data}
index="day"
series={[{ key: "hours", label: "Hours" }]}

Source Code

// Loading…

Props

Options you can pass to customize this component.

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

One object per point along the x axis.

index*
string

The key in each object that labels the x axis.

series*
{ key: string; label?: string; color?: string }[]

The keys to plot. Colors follow the chart palette in order unless you set one.

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.

highlight
number

Index of the bar to light when nothing is hovered. Defaults to the last one.

className
string

Merged onto the root element.