Skip to main content

ChartMultiples

Containers and Specs

Small multiples: one chart per facet value in a responsive grid, with shared or range-rounded scales, sort, a muted baseline and synced hover.

import { ChartMultiples } from "@elabs-ai/components-charts";
Install
npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-charts

Skipping the @source line is the most common first failure: Tailwind does not scan node_modules, so every component renders unstyled. The one-time wiring

Prompt for your coding agent

Paste it into Claude Code, Cursor, Codex or any other coding agent. Text in [brackets] is yours to fill in.

Add the brand-ui ChartMultiples chart (from @elabs-ai/components-charts) to this project.

1. Read https://elabs-ai.com/llms.txt first: it maps every package and the rules. If you can use MCP servers, connect https://elabs-ai.com/mcp and use its search, docs and tokens tools. If not, run the same lookups in the terminal: `npx -y @elabs-ai/components-cli search "<what you need>"` and `npx -y @elabs-ai/components-cli docs <Component>`.
2. Look ChartMultiples up before writing code: `npx -y @elabs-ai/components-cli docs ChartMultiples` prints its real props, variants, what it pairs with and what to avoid.
3. If @elabs-ai/components-charts is not installed yet: `pnpm add @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-charts` (or `npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-charts`). If this is the first brand-ui package in the project, wire it once: import `@elabs-ai/components-tokens/styles.css` plus the `themes/light.css` and `themes/dark.css` stylesheets in the CSS entry, add one Tailwind `@source` line per installed @elabs-ai package (Tailwind does not scan node_modules, so without it everything renders unstyled), and wrap the app root in `ThemeProvider` from `@elabs-ai/components-tokens`.
4. Use it here: [the screen or file, and what it should show]
5. Rules: use only @elabs-ai/components-* components and the semantic tokens — no raw colours, no raw font sizes, no arbitrary Tailwind values. Look up each component's real props with the docs tool before you use it; never guess a prop.
6. Done means: the typecheck passes, `npx -y @elabs-ai/components-cli audit src --strict` reports nothing, and you have opened the app and looked at every screen you touched in the light and the dark theme.

Use it for

  • many overlapping lines over time — one panel per series instead of a spaghetti chart, so each trend reads on its own
  • one measure across many categories or groups — a grid of panels that share a scale, read as one picture

Avoid

  • fewer than 3 panels, or the comparison IS the overlap — use one chart

Examples

8 live examples

Shared Scale Multiples

One shared scale: value labels paint on the first column only.

Sorted With Baseline Multiples

Sorted by % change, with the all-chip average repeated muted behind every panel.

Hide Panel On Narrow Multiples

The SRAM panel is hidden below 480 px only (`showAt: { base: true, narrow: false }`).

Explicit Narrow Density Multiples

The host names its narrow density (`{ base: "md", narrow: "md" }`), so the panels keep their value axes even on a phone-width grid.

From Chart Spec Multiples

The same shared-scale grid, emitted as a `ChartSpec` with `facet` and rendered by `AutoChart`.

Split Bars Multiples

Split bars: one panel per measure (`facet.by = { series: true }`), independent value scales.

Multiple Pies Multiples

Multiple pies: one pie per region (`facet.by = "region"`).

API

ChartMultiples

PropTypeDescription
dataT[]Long rows, split into panels by `by`. Ignored when `panels` is set.
bystring | { series: true }A column key (one panel per value), or `{ series: true }` — one panel per `dataKeys` entry over the same rows (split bars).
panelsChartMultiplesPanelInput<T>[]Explicit panels (instead of `data` + `by`).
xDataKeyrequiredstringRow key of the x value (hover lookup, shared x extent, baseline join).
dataKeysrequiredstring[]Row keys of the plotted values; the first drives sort, stats and the hovered value.
columnsResponsive<number | "auto">Panels per row, per breakpoint. Default `{ base: "auto", narrow: 1 }`.
minPanelWidthnumberMinimum panel width `columns: "auto"` packs to. Default 240.
panelHeightResponsive<ChartPlotHeight>Each panel's plot height (px or `{ aspect }`), per breakpoint. Default 200.
scalesChartMultiplesScales
sortFacetSortPanel order. Default `"data"` (input order). Numeric keys sort largest first.
reversebooleanReverse the sort order.
baselineChartMultiplesBaselineA series drawn muted behind every panel's own series: a panel `key` (removed from the grid) or a row `series` key.
showAt(panel: ChartMultiplesPanel<T>) => Responsive<boolean>Per-panel visibility, per breakpoint (a panel's own `showAt` wins).
syncHoverbooleanSynced hover: every panel shows the crosshair at the hovered category and `panelTitle` receives the hovered value. Line, Area and Composed panels only; bar and pie panels get the shared layout and domains. Default `true`.
panelTitle(panel: ChartMultiplesPanel<T>, hovered?: ChartMultiplesHover<T>) => ReactNodeTitle slot; `hovered` is set while any panel is hovered (value-in-title).
annotationsArray<ChartAnnotation & { panel?: string }>Annotations; `panel` names one panel, `"all"`/unset repeats it in every panel.
childrenrequired(panel: ChartMultiplesPanel<T>) => ReactNodeRenders one panel's chart.

Also accepts: Omit<HTMLAttributes<HTMLDivElement>, "children" | "title">