Skip to content

Marimekko Chart for React

A React Marimekko chart is a 100% stacked mosaic whose columns are as wide as their totals. Pass data as readonly ChartRow[]: one row per column.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/marimekko-chart.json

Spend by segment and vendor

  • Acme (us)
  • Northwind
  • Contoso
  • Others
Use the arrow keys to read it: left and right move between columns, up and down between the segments of a column.

  • MarimekkoChart
  • MarimekkoTable
  • defaultMarimekkoChartLabels
  • defaultMarimekkoTableLabels
  • +2 more

Market map, year on year

Columns are segments sized by total spend; cells are vendors. Switch the year: every cell reshapes in place. Arrow keys move between segments (left / right) and vendors (up / down).

Market map

Spend by segment and vendor, 2025 ($M)

$2.5Bour revenue
  • Acme (us)
  • Northwind
  • Contoso
  • Others
Use the arrow keys to read it: left and right move between columns, up and down between the segments of a column.

Revenue by region and product, values in the cells

cellText="value" prints each cell’s value instead of its share. Narrow columns keep their name only while it fits; every value stays in the tooltip and the table.

Revenue by region

By product line, fiscal 2025 totals

  • Platform
  • Analytics
  • Services
Use the arrow keys to read it: left and right move between columns, up and down between the segments of a column.

Files to copy

12 folders · 29 files · 4 packages
From theme/src/
  • components/charts/{marimekko-chart.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-tip.tsx, chart-utils.ts, flow-utils.tsx, heatmap.tsx}
  • components/charts/chart-parts/
  • components/charts/heatmap/
  • components/drawer/parts/sheet.tsx
  • components/kbd/
  • components/menu/
  • components/skeleton/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-intersection.ts, use-latest.ts, use-media-query.ts, use-preferences.ts, use-resolved-scheme.ts}
  • motion/tokens.ts
  • lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/marimekko-chart.jsonRegistry item: marimekko-chart. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".

Props

PropTypeDefaultDescription
data (required)readonly ChartRow[]NoneOne row per column, e.g. { segment: "Enterprise", us: 420, rivalA: 310, ... }.
index (required)stringNoneKey of the column name in each row.
series (required)readonly ChartSeries[]NoneThe stacked parts of every column, bottom up (≤ 8; colour slots stay fixed). Negative values count as 0.
heightnumber340Height of the chart in px; the width follows the container.
cellText"none" | "value" | "share""share"What each cell prints when it fits: its share of the column (default), its value, or nothing.
format((n: number) => string)compact numbers in localeFormats a value for the labels, tooltips and data table: takes the number, returns the text shown.
formatPercent((ratio: number) => string)percentages in localeFormats a share of the total for the tooltips and data table: takes the share, returns the text shown.
localestring"en"Locale of the default number formats.
patternsbooleantrue when series.length > 3Tell series apart without colour (hatch fills).
onCellClick((cell: MarimekkoCell) => void)NoneCalled with { column, series, seriesLabel, value } when a cell is clicked, tapped, or activated with Enter. column is the row's index value and series the series key (the data keys); seriesLabel is its display label. Makes cells interactive.
emptyStateReactNodeNoneShown when there is nothing to plot.
labelsPartial<MarimekkoChartLabels>defaultMarimekkoChartLabelsEvery other string, for translation: labels={{ roleDescription: "…" }}; omitted keys keep the English of defaultMarimekkoChartLabels. All 6 keys of MarimekkoChartLabels are listed in the key table under the props table.
aria-label (required)stringNoneNames the chart for assistive tech (required).
classNamestringNoneAdds extra classes to the outer element.
MarimekkoChartLabels keys and English defaults (6)
Pass any key in labels; the rest keep the defaults of defaultMarimekkoChartLabels.
KeyEnglish default
roleDescriptionmarimekko chart
instructionsUse the arrow keys to read it: left and right move between columns, up and down between the segments of a column.
hintTap a cell for its value
ofColumn(column) => `of ${column}`
ofTotalof total
cellTitle(column, series) => `${column} · ${series}`

MarimekkoTable props

PropTypeDefaultDescription
data (required)readonly ChartRow[]NoneOne row per column, e.g. { segment: "Enterprise", us: 420, rivalA: 310, ... }.
format((n: number) => string)compact numbers in localeFormats a value for the labels, tooltips and data table: takes the number, returns the text shown.
localestring"en"Locale of the default number formats.
index (required)stringNoneKey of the column name in each row.
series (required)readonly ChartSeries[]NoneThe stacked parts of every column, bottom up (≤ 8; colour slots stay fixed). Negative values count as 0.
formatPercent((ratio: number) => string)percentages in localeFormats a share of the total for the tooltips and data table: takes the share, returns the text shown.
indexLabelstringNoneSets the header of the first column.
captionstringNoneHidden caption that names the table for screen readers.
labelsPartial<MarimekkoTableLabels>defaultMarimekkoTableLabelsColumn headers. Merged over defaultMarimekkoTableLabels. Every other string, for translation: labels={{ total: "…" }}; omitted keys keep the English of defaultMarimekkoTableLabels. All 2 keys of MarimekkoTableLabels are listed in the key table under the props table.
emptyStateReactNodeNoneShown when there are no rows.
MarimekkoTableLabels keys and English defaults (2)
Pass any key in labels; the rest keep the defaults of defaultMarimekkoTableLabels.
KeyEnglish default
totalTotal
share% of total

Keyboard

KeysAction
TabFocus the chart (one stop).
←/→The same part in the previous / next column (or the nearest one by height).
↑/↓The next part up / down the column.
Home/EndBottom / top part of the column.
Enter/SpaceCall onCellClick for the active cell.
EscapeClear the reading.

Accessibility

  • The chart is one focusable figure with the role description “marimekko chart”; a cell is announced with its value and both shares (“Enterprise · Acme (us): $910M, 21% of Enterprise, 9% of total”).
  • Cell numbers are drawn in black or white, whichever contrasts more with the fill, and only where they fit; the Table view (MarimekkoTable) has every value.
  • On touch screens the first tap pins the readout; a second tap activates the cell.
  • Reduced motion: the columns appear at once and data changes jump.

All exports on this page

  • MarimekkoChart — A 100% stacked mosaic whose columns are as wide as their totals: market size and share in one picture (segment × vendor, region × product).
  • MarimekkoTable — Every column with each part's value, the column total and its share of everything.
  • defaultMarimekkoChartLabels — The built-in English strings of MarimekkoChart; spread it into your own labels and change what you need.
  • defaultMarimekkoTableLabels — English defaults of MarimekkoTableLabels.

When to use the marimekko chart

  • Use it as a mosaic (mekko) chart for market maps, where each column is a customer segment sized by its revenue and the stacked cells show which product lines or competitors hold that segment.
  • It works for a revenue-by-region and product breakdown in a board deck, because column width carries the region's size while cell height carries the product's share inside it.
  • Try cellText value when readers want the numbers rather than percentages, for example fiscal revenue per product line printed inside each cell wherever it fits.
  • Skip it when you have more than a handful of columns or need exact comparisons across categories; PercentBarChart or a plain BarChart reads more cleanly than narrow columns with clipped text.
  • Pair it with ChartCard and its Chart / Table tabs, MarimekkoTable for a text version with totals and shares, and seriesLegend so each stacked part is named once, outside the cells.

Frequently asked questions

48 charts pages in all: browse them on Charts.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .