Xzero UI
Pro library

Metric card

A compact summary for a number that needs context.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/metric-card
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/metric-card

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 { MetricCard } from "@/components/xzero/metric-card/metric-card";

export function Uptime() {
  return <MetricCard label="Uptime" value={99.9} suffix="%" context="Last 30 days" change="+0.2%" />;
}

API reference

MetricCard

A compact card with a label, an odometer style number, context line, and optional change chip.

PropTypeDefaultDescription
label (required)string–What is measured.
value (required)number–The number. Rolls up from zero on first view, then between values.
suffixstring–Text after the number, such as "%" or " ms".
context (required)string–Line under the number, such as "vs last week".
changestring–Chip in the top corner, such as "+12%". Omit to hide it.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in cards

Guidance for AI tools

Metric card: A compact summary for a number that needs context. 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