Skip to content

Metric Card

⋯

The Metric card page renders the Figma Metric Chart Card, Metric Chart Modal, Metric Group Card, .Metric Tile, KPI Summary Card, and Funnel Stage Card. The cards compose the Trend Indicator, .Metric Label, Metric Value, and Metric Stat primitives with a card surface and, for chart cards, a Line Chart Plot.

import { MetricValue, TrendIndicator } from "@nesra/ui/metric";
export function Spend() {
return (
<MetricValue size="lg">
<MetricValue.Label definition="Total spend across active campaigns.">Spend</MetricValue.Label>
<MetricValue.Amount unit="IDR" value="46,824.98" />
<MetricValue.Comparison label="Vs. previous period">
<TrendIndicator direction="up" value="12.5%" />
</MetricValue.Comparison>
</MetricValue>
);
}

Every export on this page is also available from @nesra/ui.

MetricValue Figma Metric Value
├── MetricValue.Label .Metric Label, Type=Title
├── MetricValue.Amount value row: prefix, value, unit
└── MetricValue.Comparison comparison row: label + TrendIndicator
MetricStat Figma Metric Stat: value above a .Metric Label, Type=Caption
MetricLabel Figma .Metric Label
TrendIndicator Figma Trend Indicator

Metric cards:

MetricChartModal Dialog root shared by the card and the modal
├── MetricChartCard Figma Metric Chart Card
│ ├── MetricChartCard.Header title row
│ │ ├── MetricChartCard.Title .Metric Label, Type=Title
│ │ └── MetricChartCard.Actions revealed on hover or focus
│ │ └── MetricChartModal.Trigger zoom button
│ ├── MetricValue | MetricChartCard.Stats Type=Single | Type=Benchmark
│ ├── AiInlineInsight optional, Show AI Insight
│ ├── MetricChartCard.Chart optional legend + compact LineChartPlot
│ └── MetricChartCard.Loading replaces the value and chart while loading
└── MetricChartModal.Content Figma Metric Chart Modal: title and close button
├── MetricValue | MetricChartModal.Stats
└── MetricChartModal.Chart optional legend + expanded LineChartPlot
MetricGroupCard Figma Metric Group Card
├── MetricGroupCard.Title
└── MetricGroupCard.Tiles
└── MetricTile Figma .Metric Tile: MetricValue + MetricStat
KpiSummaryCard Figma KPI Summary Card
├── KpiSummaryCard.Header icon, title, description, action
└── KpiSummaryCard.Details
├── KpiSummaryCard.Value
├── KpiSummaryCard.Comparison text + badge TrendIndicator
└── AiInlineInsight optional, Show AI Insight
FunnelStageCard.Group radio group for a funnel row
└── FunnelStageCard Figma Funnel Stage Card: title, radio, pointer
├── FunnelStageCard.Value figure + optional action
└── FunnelStageCard.Meta
└── FunnelStageCard.MetaItem label + value, with FunnelStageCard.MetaMuted text

variant="inline" renders the filled Signal caret with colored text. variant="badge" renders a bordered chip with a trending icon. size="sm" uses Body/XSmall/Medium and size="md" uses Body/Small/Medium.

Up 12.5%Down 12.5%No change 0.00%Up 12.5%
Up 12.5%Down 12.5%No change 0.00%Up 12.5%

The icon always shows the real direction. polarity sets whether that direction is good. Use lower-is-better for cost metrics such as CPA, CPM, or cost per result. flat is always neutral.

Clicks (higher is better)
Clicks up 12% versus last weekClicks down 3% versus last week
Cost per result (lower is better)
Cost per result up 12% versus last weekCost per result down 3% versus last week

A definition adds the dashed underline and turns the label into a Tooltip Trigger that opens the definition.

SpendRanking

md uses Heading/H6, lg uses Heading/H5 for cards and tiles, and xl uses Heading/H4 for the expanded modal. A TrendIndicator inside MetricValue.Comparison follows the size: sm for md and md for lg and xl. Its own size prop overrides that.

Spend (md)
46,824.98IDR
Vs. previous periodUp 12.5%
Spend (lg)
46,824.98IDR
Vs. previous periodUp 12.5%
Spend (xl)
46,824.98IDR
Vs. previous periodUp 12.5%

width="fill" spans the column. The unit and trend move to the end, and the value and comparison label truncate with an ellipsis when the column is narrow.

Spend
46,824.98IDR
Vs. previous periodUp 12.5%
Reach
1,204,330,912
Vs. previous periodNo change 0.00%

These are Figma’s “Show Value Tooltip” and “Show Comparison Tooltip”. exactValue on MetricValue.Amount shows the exact figure behind a rounded or truncated value. previousValue on MetricValue.Comparison shows the comparison figure, such as the previous period’s value. Each one renders a Basic Tooltip below the target, aligned to its start (Figma Variant=Top, Position=Left): the title in Body/XSmall/Regular and the value in Body/XSmall/Medium, in text-inverse on bg-inverse. The titles default to “Exact value” and “Previous period”. Change them with exactValueLabel and previousValueLabel.

The targets are native buttons. Hover, keyboard focus, or a tap opens the tooltip. Figma does not define a hover or pressed style for them, so the code adds only the focus ring.

Spend
IDR
Revenue
IDR

MetricValue.Amount and MetricStat never format numbers themselves. Pass display text as a string, or pass a number with a formatter. The application chooses the locale, decimals, currency, and compact notation, so server and client output match.

Cost per result
Rp12.400
Vs. previous periodDown 4,1%
Benchmark17.486.428
17,486,428
Ranking3 / 227

The Figma .Metric Tile pairs a fill-width Metric Value with a Metric Stat on the gray card surface. Use align="end" for a definition at the right edge so the popup stays inside the card.

0
Vs. previous periodNo change 0.00%
34,243,443

The Figma Type=Single card. On devices with hover, the zoom button appears while the pointer is over the card or keyboard focus is inside the actions, and the card lifts to Box Shadow/shadow-lg. On touch devices the button stays visible. The zoom button opens the Metric Chart Modal with the expanded 480px plot.

46,824.98IDR
Vs. previous periodUp 12.5%
Spend Daily spend in IDR from July to September 2026.
Spend data
CategorySpend
2026-07-015.20K
2026-07-228.60K
2026-08-127.30K
2026-09-0212.40K
2026-09-2319.90K

MetricChartCard.Stats places a fill-width Metric Value beside Metric Stat columns. A chart with more than one series shows a start-aligned legend. Inside MetricChartModal.Content, the stats row gap grows from 16px to 32px and the Metric Value uses size="xl".

72,752,330
Vs. previous periodUp 12.5%
17,486,428
3 / 227
  • Brand
  • Benchmark
Reach Daily reach of your brand and the benchmark from July to September 2026.
Reach data
CategoryBrandBenchmark
2026-07-015.20K1.20K
2026-07-228.60K300.00
2026-08-127.30K3.10K
2026-09-0212.40K11.30K
2026-09-2319.90K9.30K

Figma Show AI Insight places a Tinted, sm AI Inline Insight after the value and before the chart.

3,400IDR
Vs. previous periodDown 12%

Cost per result fell 12% after budget moved to the best ad set.

Cost per result Daily cost per result in IDR from July to September 2026.
Cost per result data
CategoryCost per result
2026-07-014,100
2026-07-223,900
2026-08-124,300
2026-09-023,600
2026-09-233,400

MetricChartCard.Loading replaces the value and the plot with skeletons in a busy status region. Keep the header so the card keeps its name.

Spend
Loading metric

MetricTile is the Figma .Metric Tile. The tile grid has one column. Add grid column classes, such as sm:grid-cols-2, to MetricGroupCard.Tiles for a wider card.

Reach and frequency

0
Vs. previous periodNo change 0.00%
34,243,443
0.00
Vs. previous periodNo change 0.00%

Trending Down and Trending Up are Trend Indicator directions inside KpiSummaryCard.Comparison. The header action is any control the page owns, such as a Checkbox with an accessible name.

RevenueAll stores
Rp 999.000.000
Down from last weekDown 12.5%
RevenueAll stores
Rp 999.000.000
Up from last weekUp 12.5%

Figma Show AI Insight places a Tinted, sm AI Inline Insight at the bottom of KpiSummaryCard.Details. Keep the copy to two lines at the 275px card width.

RevenueAll stores
Rp 999.000.000
Down from last weekDown 12.5%

Fewer repeat orders after the promo ended.

Each card is one radio in FunnelStageCard.Group. A press on the card surface selects its stage. A press on the title definition, a meta definition, or the action does not. The selected card turns Categorical/Blue/subtle with a 1.5px Stroke/stroke-link border and a pointer toward the detail panel below. The page renders that panel from the selected value.

Showing details for Awareness.

The primitives read only semantic roles, so the same markup follows the page theme.

Part Figma variable
Inline, positive Text/text-success, Icon/icon-success
Inline, negative Text/text-destructive, Icon/icon-destructive
Inline, flat Text/text-support, Icon/icon-muted
Badge, positive Categorical/Green/subtle, Stroke/stroke-success, Categorical/Green/foreground
Badge, negative Categorical/Red/subtle, Stroke/stroke-destructive, Categorical/Red/foreground
Badge, flat Foundation/bg-gray, Stroke/stroke-border, Text/text-body, Icon/icon-muted
Title label, value, stat value Text/text-headline
Caption label, comparison label Text/text-support
Unit and prefix Text/text-body
Definition underline Stroke/stroke-border-strong, Stroke/stroke-link on hover and open
Value and comparison tooltips Foundation/bg-inverse, Text/text-inverse

The cards read these Figma variables. Use the theme select in the header to compare both modes.

Card part Figma variable
Chart card, group card, KPI details surface Surface/card-bg-neutral
Chart card and group card border Stroke/stroke-border
Chart card hover, Funnel Stage Card hover Box Shadow/shadow-lg, Box Shadow/shadow-md
Modal surface Surface/popover-bg-neutral, 1px Stroke/stroke-border, Box Shadow/shadow-xl
Modal and group card title Text/text-headline, Body/Large/Semibold
Plot tooltip Foundation/bg-inverse, Text/text-inverse
Tile, KPI card, unselected Funnel Stage Card Surface/card-bg-gray
KPI details border Stroke/stroke-divider
KPI icon, zoom and close icons Icon/icon-neutral
Selected Funnel Stage Card and pointer Categorical/Blue/subtle, Stroke/stroke-link
Funnel Stage Card focus Box Shadow/Focus ring
Funnel meta label, meta value Text/text-support, Text/text-body
Funnel action Primary Button: Action/primary-default, Icon/icon-on-brand
  • TrendIndicator hides its visible value from assistive technology and renders screen-reader text instead. The default text is the direction and the value, such as “Up 12.5%”. Pass label to add the metric or period, such as “Cost per result up 12% versus last week”.
  • Color shows sentiment, while the icon shape and the text carry the direction. Do not rely on color alone to say whether a change is good. Name the metric in visible text or in label.
  • The default direction words come from the Up {value}, Down {value}, and No change {value} keys of interface translations.
  • A label with a definition is a native button. Hover, keyboard focus, or a tap opens the definition, and the definition is also the button’s accessible description.
  • MetricStat renders the caption before the value in the DOM, so a screen reader announces “Benchmark 17,486,428”. CSS shows the value above the caption.
  • Truncated values keep their full text in the DOM. Set exactValue to show the exact value to sighted users in a tooltip.
  • With exactValue, the prefix and figure are one button named by the visible figure. With previousValue, the comparison label and Trend Indicator are one button, so do not put other interactive content in that row. The tooltip title and value are each button’s accessible description, even while the tooltip is closed.
  • These tooltips use Base UI Tooltip, the Figma Basic Tooltip. Base UI ignores touch for hover, so a press also opens the tooltip. A second press keeps it open. Escape, blur, pointer exit, or an outside press closes it. Focus stays on the button.
  • The “Exact value” and “Previous period” defaults come from interface translations.
  • MetricChartModal.Trigger is a button named by label, which defaults to “Zoom in”. Name the metric, such as “Zoom in on Spend”, when a page has several cards. Hidden actions stay in the tab order, and focus reveals them.
  • MetricChartModal.Content is a dialog named by its title. Focus moves into it on open, Escape and the close button close it, and focus returns to the zoom button. The close button is named by closeLabel, which defaults to “Close”.
  • MetricChartCard.Chart renders a LineChartPlot figure with a hidden data table. Its label and summary name and describe the figure.
  • MetricChartCard.Loading is a busy <output> with the default text “Loading metric”.
  • FunnelStageCard.Group is a radio group. Give it an aria-label or aria-labelledby. Each radio is named by its card title. Tab reaches the selected radio, arrow keys move between stages and select them, and the card shows the focus ring while its radio has keyboard focus. Definitions and actions inside a card are separate Tab stops.
  • KpiSummaryCard.Header hides its icon from assistive technology. Give the header action its own accessible name.
  • The “Zoom in”, “Close”, and “Loading metric” defaults come from interface translations.

Renders a <span> and forwards native span attributes, className, and its ref.

Prop Type Default Effect
direction "up" | "down" | "flat" Required Sets the icon and the direction word.
value string Required Preformatted change, including its unit.
polarity "higher-is-better" | "lower-is-better" "higher-is-better" Sets whether up is positive or negative. Flat is always neutral.
variant "inline" | "badge" "inline" Caret with colored text, or a bordered chip with a trending icon.
size "sm" | "md" "sm" Text and icon size. Inside MetricValue.Comparison, follows the Metric Value.
label string — Replaces the screen-reader text.

The span has data-slot="trend-indicator", data-direction, data-sentiment, data-variant, and data-size. getTrendSentiment(direction, polarity) returns "positive", "negative", or "neutral" for a matching color elsewhere, such as an insight number.

Renders a <span data-slot="metric-label"> and forwards its ref to that span.

Prop Type Default Effect
children ReactNode Required Metric name.
type "title" | "caption" "title" Body/Medium/Semibold headline text, or Body/Small/Regular support text.
definition ReactNode — Renders a Tooltip Trigger button with this definition.
definitionTitle ReactNode — Heading inside the definition popup.
align "start" | "center" | "end" "start" Aligns the definition popup with the label.
className string — Classes for the outer span.

Renders a <div data-slot="metric-value"> and forwards native div attributes and its ref.

Prop Type Default Effect
size "md" | "lg" | "xl" "md" Heading/H6, H5, or H4 for the value, with matching unit and comparison text.
width "hug" | "fill" "hug" Keeps parts adjacent, or spans the column and truncates.

Renders a MetricLabel with type="title". It accepts every MetricLabel prop except type.

Renders a <div data-slot="metric-value-amount"> and forwards native div attributes and its ref.

Prop Type Default Effect
value string | number Required Display text, or a number for formatter.
formatter (value: number) => string Required for a number Converts a numeric value to display text.
prefix ReactNode — Text before the value, in the unit style.
unit ReactNode — Text after the value, such as a currency code.
exactValue ReactNode — Exact figure in the value tooltip. Makes the prefix and figure a button.
exactValueLabel ReactNode "Exact value" Title of the value tooltip.

Renders a <div data-slot="metric-value-comparison"> and forwards native div attributes and its ref. Put a TrendIndicator in children.

Prop Type Default Effect
label ReactNode — Comparison period before the trend.
previousValue ReactNode — Comparison figure in the comparison tooltip. Makes the label and trend a button.
previousValueLabel ReactNode "Previous period" Title of the comparison tooltip.

Renders a <div data-slot="metric-stat"> and forwards native div attributes and its ref.

Prop Type Default Effect
label ReactNode Required Caption below the value.
value string | number Required Display text, or a number for formatter.
formatter (value: number) => string Required for a number Converts a numeric value to display text.
definition ReactNode — Turns the caption into a Tooltip Trigger.
definitionTitle ReactNode — Heading inside the definition popup.
align "start" | "center" | "end" "start" Aligns the definition popup with the caption.

The prop types TrendIndicatorProps, MetricLabelProps, MetricValueProps, MetricValueLabelProps, MetricValueAmountProps, MetricValueComparisonProps, MetricStatProps, and MetricNumberProps are exported, with the value types TrendDirection, TrendPolarity, TrendSentiment, TrendIndicatorVariant, TrendIndicatorSize, MetricLabelType, MetricValueSize, and MetricValueWidth.

Renders a <div data-slot="metric-chart-card"> and forwards native div attributes and its ref. Parts forward their native attributes and refs.

Part Renders Props
MetricChartCard.Header <div> row, 32px min height Native div props.
MetricChartCard.Title MetricLabel title type Every MetricLabel prop except type.
MetricChartCard.Actions <div> revealed on hover Native div props.
MetricChartCard.Stats <div> bottom-aligned row Native div props. 16px gap in the card, 32px in a modal.
MetricChartCard.Chart legend and LineChartPlot See below.
MetricChartCard.Loading busy <output> label?: string, default “Loading metric”.

MetricChartCard.Chart accepts every LineChartPlot prop, including the required label, summary, data, and series, plus:

Prop Type Default Effect
showLegend boolean true with more than one series Shows the series labels above the plot.
size "compact" | "expanded" compact in a card, expanded in a modal Plot height: 200px or 480px.

Accepts the Dialog root props, such as open, defaultOpen, and onOpenChange.

Part Renders Props
MetricChartModal.Trigger Ghost icon-sm Button with a tooltip label?: string and tooltip?: ReactNode, both default “Zoom in”, plus Button props except variant, size, and children.
MetricChartModal.Content Dialog content, up to 1200px wide Required title: ReactNode, closeLabel?: string (default “Close”), plus Dialog content props.
MetricChartModal.Stats The MetricChartCard.Stats part Native div props.
MetricChartModal.Chart The MetricChartCard.Chart part Same as MetricChartCard.Chart, expanded by default.

MetricGroupCard renders a <div data-slot="metric-group-card">. MetricTile renders a <div data-slot="metric-tile">. Both forward native div attributes and refs.

Part Renders Props
MetricGroupCard.Title heading as?: "h2" | "h3" | "h4" | "h5" | "h6", default h3, plus native heading props.
MetricGroupCard.Tiles <div> grid Native div props. One column with a 16px gap.

Renders a <div data-slot="kpi-summary-card"> and forwards native div attributes and its ref.

Part Props
KpiSummaryCard.Header Required title: ReactNode. Optional description, icon (24px, decorative), and action nodes. Native div props.
KpiSummaryCard.Details Native div props.
KpiSummaryCard.Value Native div props. Children are display text in Heading/H6.
KpiSummaryCard.Comparison label?: ReactNode. Children are a TrendIndicator. Native div props.

Renders a <div data-slot="funnel-stage-card"> with a Base UI radio. It must be inside FunnelStageCard.Group.

Prop Type Default Effect
value string Required Stage value reported by the group.
title ReactNode Required Stage name. It names the radio.
definition ReactNode — Renders the title as a Tooltip Trigger with a Rich Tooltip.
definitionTitle ReactNode — Heading inside the definition popup.
disabled boolean false Prevents selecting the stage.
onClick (event) => void — Runs before the card selects its stage. preventDefault() cancels the selection.
Part Props
FunnelStageCard.Group Base UI radio group props with value?: string | null, defaultValue?: string | null, and onValueChange?: (value: string, details) => void.
FunnelStageCard.Value action?: ReactNode. Children are the figure in Heading/H5. Native div props.
FunnelStageCard.Meta Native <dl> props.
FunnelStageCard.MetaItem Required label: ReactNode, optional definition and definitionTitle. Children are the value.
FunnelStageCard.MetaMuted Native span props for support-colored text inside a value, such as “/”.

Each part’s prop type is exported with the part’s name and a Props suffix, such as MetricChartCardChartProps, MetricChartModalContentProps, MetricTileProps, KpiSummaryCardHeaderProps, and FunnelStageCardGroupProps.

See colors, typography, and layout for the token contract.