OfferLifetime Pro for $99

Breakdown Chart

Pass flat rows and pick the measure, slice by day, week or month, and segment by any dimension. Hover a bar for its breakdown; the sortable table below shows the same segments, and hovering either lights the other. The legend toggles segments, empty periods show as gaps, and the plot can be walked with the arrow keys.

The decision inside it

Small segments become "Other"

Twelve thin coloured slivers are noise. Past five segments the smallest fold into one grey Other band, and clicking it opens it up. Colours follow the segment, not its position, so hiding one never repaints the rest.

When to use it

Use Breakdown Chart for a stacked bar chart people re-cut themselves: pick the measure, slice by day, week or month, and segment by any dimension, with a linked sortable table and small segments folded into Other. Pass flat rows; it sums them. For one total split into parts use Compact Breakdown.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's Breakdown Chart for this.
Install it: npx shadcn@latest add @layro/breakdown-chart
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/breakdown-chart.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.

Usage

components/revenue-breakdown.tsx
import { BreakdownChart, type BreakdownRecord } from "@/components/ui/breakdown-chart";

const usd = (v: number) => v.toLocaleString("en-US", { style: "currency", currency: "USD" });

export function RevenueBreakdown({ orders }: { orders: BreakdownRecord[] }) {
  return (
    <BreakdownChart
      title="Revenue"
      rows={orders}
      dateKey="date"
      measures={[{ key: "revenue", label: "Revenue", format: usd }, { key: "orders", label: "Orders" }]}
      dimensions={[{ key: "channel", label: "Channel" }, { key: "region", label: "Region" }]}
      defaultSliceBy="week"
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
rowsrequiredBreakdownRecord[]—
dateKeystringField holding an ISO date ("2026-10-03"). Default "date".
measuresrequiredBreakdownMeasure[]—
dimensionsrequiredBreakdownDimension[]—
titleReact.ReactNode—
measurestring—
defaultMeasurestring—
onMeasureChange(key: string) => void—
sliceBySliceBy—
defaultSliceBySliceBy—
onSliceByChange(s: SliceBy) => void—
segmentBystring—
defaultSegmentBystring—
onSegmentByChange(key: string) => void—
maxSegmentsnumberSegments shown in colour before the rest fold into "Other". Default 5 (max 8).
fromstringFirst day of the range (ISO). Default: the earliest row.
tostringLast day of the range (ISO). Default: the latest row.
heightnumberPlot height in px. Default 220.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-themesegmented-control

States

All of them are drawn by the component. None is left for you to design.

  • Revenue by channel
  • Other opened
  • Segment hidden
  • Hovered
  • Empty period
  • No data

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Used in a screenAll screens

Lifetime access

Every component, and everything we ship next.

  • All 232 components, source included
  • Every template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.