Skip to content
InsightCharts

Search

Search guides and components

Metric breakdown

A headline number with its composition underneath: one segmented bar and a key giving each part's value and share.

Use when
A total that the reader will immediately want split: a budget by department, revenue by product line, emissions by sector. Two to six parts that add up to the number above them.
Avoid when
Parts that do not sum to the headline; more than about six parts (use bar chart); composition compared across groups or over time (use bar chart with stack: "percent" or area chart).

Preview

Greenhouse gas emissions, EU-27, 2022
3,291
Million tonnes of CO2 equivalent. 31% below the 1990 level.
Energy supply
86226%
Transport
80424%
Industry
70121%
Buildings
43713%
Agriculture
37811%
Waste
1093%

Source: European Environment Agency · Rounded, approximate figures for illustration

Composition

Built from

The pieces metric breakdown renders or expects in its slots.

Atoms

2

A featured statistic with its label, change and the context that gives it meaning.

Splits one whole into proportional segments along a single horizontal bar.

Used in

No template lists metric breakdown in its composes. It still fits any slot that takes a component.

Installation

$ pnpm dlx shadcn@latest add @insightcharts/metric-breakdown

The CLI copies the source into your project and needs the @insightcharts registry in components.json; see installation. With the package, import it by name:

import { MetricBreakdown } from "insightcharts";

Examples

Three parts, shares only

Monthly recurring revenue
$589K
+6.4% vs September
Enterprise
54%
Team
34%
Starter
12%

Illustrative data

Hero, sorted

Seats in the House of Commons, 2024
650
Labour
41163%
Conservative
12119%
Liberal Democrat
7211%
Others
376%
SNP
91%

Source: House of Commons Library · Figures are approximate, for illustration

Props

PropTypeDefaultDescription
labelrequiredstringWhat the headline number measures.
dataDataInputOne row per part. Omit inside <InsightData>.
transformTransform | Transform[]Applied before the parts are summed.
namerequiredstringField naming each part.
valuerequiredstringField with each part's value.
totalnumber | stringThe headline number. Default: the sum of the parts.
contextstringThe line under the headline number.
deltanumber | stringChange in the headline number. Numbers render as signed percentages.
deltaLabelstringWhat the delta is against.
upIsGoodbooleantrueWhether an increase is good news.
size"hero" | "stat""stat"hero when this opens a piece.
show"both" | "value" | "share""both"What the key prints beside each part.
sort"none" | "desc""none"Order parts by size; the bar and the key follow.
namesRecord<string, string>Display names for part keys.
formatFormatSpec"auto"Number format for the headline and the parts.
sourcestringShown underneath as "Source: ...".
notestringMethod note or caveat.
themeThemeInputTheme override, passed on to the number and the bar.
mode"auto" | "system" | "light" | "dark""auto"Colour mode.