Xzero UI
Pro library

Metric tickerPro

A strip of live KPIs that roll to new values digit by digit and flash their change; rest on one to pause the strip and open its recent trend as a sparkline.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/metric-ticker
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/metric-ticker

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { MetricTicker, type TickerMetric } from "@/components/xzero/metric-ticker/metric-ticker";

export function HealthStrip({ stats }: { stats: LiveStats }) {
  const metrics: TickerMetric[] = [
    { id: "mrr", label: "Monthly recurring revenue", value: stats.mrr, format: { style: "currency", currency: "USD", maximumFractionDigits: 0 } },
    { id: "active", label: "Active now", value: stats.activeUsers },
    { id: "conversion", label: "Trial conversion", value: stats.conversion, format: { style: "percent", maximumFractionDigits: 1 }, delta: "absolute", caption: "Rolling 7 days" },
    { id: "latency", label: "API p95", value: stats.p95, format: { style: "unit", unit: "millisecond" }, positive: "down", delta: "absolute", history: stats.p95History },
  ];

  return <MetricTicker metrics={metrics} label="Product health" />;
}

API reference

MetricTicker

A strip of live KPIs for the top of a dashboard. Each value rolls to its new reading digit by digit, ones first and each higher place a beat later like a mechanical counter, and its change flashes beside it as an arrow and an amount, green or red by whether the move is good news for that metric, before settling into a quieter tone. Rest on a metric, focus it or tap it and a floating panel grows out of it with a sparkline of recent values that draws itself in, the trend and the low and high; moving to the next metric glides the same panel across. When the metrics do not fit, the strip becomes a slow marquee that glides to a stop under the pointer, can be dragged or flicked and eases back into its drift, or a plain horizontal scroll.

PropTypeDefaultDescription
metricsreadonly TickerMetric[]–The metrics in order: { id, label, value, format?, delta?, positive?, history?, caption? }. Pass a new array whenever a value changes; changes are matched by id.
metrics[].formatIntl.NumberFormatOptions–Number format for the value, such as currency, percent or a unit like { style: "unit", unit: "millisecond" }. Defaults to whole numbers.
metrics[].delta"percent" | "absolute""percent"How the change reads: relative to the previous value, or as the raw difference in the metric's own format. Absolute changes of a percent metric read in points, such as 0.3 pts.
metrics[].positive"up" | "down""up"Which direction is good news. Set down for latency, error rate or churn so a rise flashes red.
metrics[].historyreadonly number[]–Recent values, oldest first, for the sparkline. Leave it out and the ticker keeps its own history from the values it has seen.
metrics[].captionstring–Context at the top of the panel, such as Rolling 7 days. Defaults to Last n updates.
overflow"marquee" | "scroll""marquee"What happens when the metrics do not fit: a slow marquee that pauses on hover, focus and while a panel is open, or plain horizontal scrolling with snap points. Metrics that fit simply share the width.
speednumber32Marquee drift in pixels per second.
flashDurationnumber1600How long a change stays emphasised before the delta settles to its resting tone, in milliseconds.
historyLengthnumber24Points kept for the sparkline when history is not passed.
localestring"en-US"Formatting locale. Fixed by default so server and client render the same digits.
labelstring"Live metrics"Accessible name of the strip.
classNamestring–Class on the root element.
styleCSSProperties–Inline styles on the root element.

Keyboard interactions

KeysAction
TabMoves focus into the strip, onto the last focused metric. Focus opens its panel and pauses the marquee, bringing the metric into view.
Arrow Left / Arrow RightMoves focus to the previous or next metric, wrapping at the ends; the panel glides with it.
Home / EndMoves focus to the first or last metric.
Enter / SpacePins the panel open, or closes a pinned panel.
EscapeCloses the panel.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in cards

Guidance for AI tools

Metric ticker: A strip of live KPIs that roll to new values digit by digit and flash their change; rest on one to pause the strip and open its recent trend as a sparkline. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components