Stacked Pill Bars
A shadcn chart card: two stacked series drawn as separate pills with a hatched base, a headline figure, period pills, legend and tooltips.
Interactive preview · desktop · dark
Installation
Installation is available on the Startup and Business plans. Your personal install command appears here once you have access.
Usage
Import it, pass your props, and make it part of your product.
example.tsx
import { StackedBarsChart } from '@/components/component-kit/items/chart-stacked-bars';
export function Example() { return ( <StackedBarsChart title="Workouts logged" summaryLabel="This quarter" series={{ base: { label: 'Strength' }, top: { label: 'Cardio' } }} periods={[{ value: 'w', label: 'Week' }, { value: 'q', label: 'Quarter' }]} data={[ { label: 'Oct', base: 18, top: 9 }, { label: 'Nov', base: 22, top: 12 }, { label: 'Dec', base: 15, top: 14 }, ]} /> );}Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | StackedBarsDatum[] | — | One row per column with base and top values. |
series | { base, top } | Returning / First-time | Labels and light/dark colors for the two series. |
periods | StackedBarsPeriod[] | — | Period pills in the header; controlled with period/onPeriodChange. |
hatchBase | boolean | true | Hatch the lower series. |
radius | number | 7 | Corner radius of each segment in pixels. |