Updated
Stacked Bars
ProCustomize
Stacked
Currency
Months12
Installation
ProStacked Bars is a Pro component
Sign in to see the source, or install it with a license key. The live preview and props above are free to explore.
Install with a key
- Add the Pro registry to
components.json:components.json { "registries": { "@uibrik-pro": { "url": "https://uibrik.com/r/pro/{name}.json", "headers": { "Authorization": "Bearer ${UIBRIK_LICENSE}" } } } } - Put your key in
.env.localand add that file to.gitignore:.env.local UIBRIK_LICENSE=your-license-key - Install it:
Terminal npx shadcn@latest add @uibrik-pro/stacked-bars
Loading your installation…
Usage
import { StackedBars } from "@/components/uibrik/stacked-bars/stacked-bars";const series = [ { key: "starter", label: "Starter" }, { key: "pro", label: "Pro" }, // …1 more];<StackedBars title="Revenue by plan" defaultMode="stacked" series={series} onModeChange={(mode) => {}} // data={[{ label: "…" }]} // mode="stacked"/>Where to use Stacked Bars
Revenue by segment
Monthly columns split by series show both totals and parts.
Pairs with Area Chart
Category trends
Sliding apart into groups makes comparing one series across months easy.
Marketing reports
A legend that folds series away focuses on the channels that matter.
Props
StackedBars- title
- Type string
- "Revenue by plan"
- Names what is plotted.
- defaultMode
- Type "stacked" | "grouped"
- "stacked"
- Starting layout: one column per period, or series side by side.
- data
- Type { label: string; [key: string]: number }[]
- –
- One row per period, oldest first, with a value for each series key.
- series
- Type { key: string; label: string; color?: string }[]
- –
- The series to draw, bottom of the stack first.
- mode
- Type "stacked" | "grouped"
- –
- Controls the layout. Pair with onModeChange.
- onModeChange
- Type (mode) => void
- –
- Called when the layout tabs change.
- format
- Type Intl.NumberFormatOptions
- USD currency
- Formats every number, e.g. { style: "percent" }.
- className
- Type string
- –
- Classes for the outer shell.