Amounts over periods as rounded bars, stacked into one column per period or grouped side by side, in a dashboard card.
Stacked: cash in and out
Each month's column is the inflow with the outflow stacked on top in grey. Hover or focus a month (arrow keys move) for each part and the total; the period switch swaps months for quarters.
Cash position
$494,320
+8.2% vs last year| Month | Cash inflow | Cash outflow |
|---|---|---|
| Jan | $18,400 | $12,900 |
| Feb | $21,600 | $14,100 |
| Mar | $19,800 | $13,200 |
| Apr | $24,200 | $15,800 |
| May | $22,900 | $14,600 |
| Jun | $26,400 | $16,900 |
| Jul | $25,100 | $15,400 |
| Aug | $28,640 | $12,480 |
| Sep | $27,300 | $17,200 |
| Oct | $30,100 | $18,100 |
| Nov | $29,200 | $16,800 |
| Dec | $33,800 | $19,400 |
- Cash inflow
- Cash outflow
Installation
Copies the component into src/design-system/ as your own source, with only the files it needs.
npx avesk-ui@latest add bar-chart-cardBrings the 8 files it builds on (chart.tsx, badge.tsx, dropdown-menu.tsx, button.tsx, glyph.tsx, icon.tsx, floating.tsx, segmented-control.tsx). The first time, it also adds the tokens and the cn() helper, imports the tokens in globals.css and installs clsx and tailwind-merge. Files already in your project are kept unless you add --force.
Import
Lives in src/design-system/components/bar-chart-card.tsx.
import { BarChartCard } from "@/design-system/components/bar-chart-card";Usage
<BarChartCard
title="Cash position"
data={[{ label: "Jan", inflow: 18400, outflow: 12900 }, …]}
series={[
{ key: "inflow", label: "Cash inflow", color: "brand" },
{ key: "outflow", label: "Cash outflow", color: "neutral" },
]}
format={(n) => formatMoney(n)}
formatAxis={(n) => formatMoney(n, { compact: true })}
/>Examples
Grouped: compare by week
variant="grouped" puts a bar per series side by side, here billable against non-billable hours, with footer="tiles" for each series' total.
Hours logged
1135 h
+6.4% vs the six weeks before| Week | Billable | Internal |
|---|---|---|
| W1 | 142 h | 38 h |
| W2 | 156 h | 31 h |
| W3 | 131 h | 44 h |
| W4 | 168 h | 27 h |
| W5 | 160 h | 35 h |
| W6 | 174 h | 29 h |
- Billable931 h
- Internal204 h
When to use
Use it when
- Two or three amounts in the same unit over periods: cash in and out by month, billable and non-billable hours by week
- How a total per period is made up (stacked) or how series compare in each period (grouped)
Don’t use it when
- A trend over many periods where the shape matters more than each value → Area chart card
- An amount and a rate on different axes → Combo chart card
- Ranking items, not periods → Bar list card
Rules
- Keep it to 1–4 series and 4–12 periods so every bar stays readable
- Stacked parts sit bottom-up in `series` order; put the main series first and a quieter one (`neutral`) on top
- Give `format` for values and `formatAxis` for a compact axis, e.g. formatMoney(n, { compact: true })
- Use `brand` for the main series so it follows the theme
Properties
BarChartCard
| Prop | Type | Default |
|---|---|---|
title * | string | – |
data * | ChartRow[] | – |
series * | ChartSeries[] | – |
variant | "stacked" | "grouped" | "stacked" |
value | string | – |
change | number | – |
changeLabel | string | – |
invertChange | boolean | – |
period | ChartPeriod | – |
format | NumberFormat | formatNumber |
formatAxis | NumberFormat | – |
categoryLabel | string | "Period" |
footer | "legend" | "tiles" | "none" | "legend" |
height | number | 240 |
headingLevel | 2 | 3 | 4 | – |
className | string | – |
* required
Accessibility
- The SVG has role="img" and an aria-label summary; a visually hidden table lists every value
- Every period is a focusable target with one Tab stop: arrows move, Home/End jump, Escape hides the tooltip; its aria-label reads each series and the total
- The tooltip and headline follow hover and focus alike; meaning never relies on colour (labels and values sit next to every swatch)
- The grow-in animation only runs without prefers-reduced-motion