Skip to Content

Metric Card

KPI stat card for dashboards and analytics: a metric name, a large tabular value, an optional outline badge with a trend-up or trend-down icon and screen-reader label, and an optional description line.

View as Markdown
pnpm dlx shadcn add @01orbital/metric-card

Usage

import { MetricCard } from "@/components/card/metric-card"

// The demo's words. Change copy here, not in the markup.
const COPY = {
  name: "Total visitors",
  value: "248.5k",
  change: "12.4%",
  up: "Up",
  period: "vs last period",
} as const

export default function MetricCardDemo() {
  return (
    <>
      {/* 276px: one column of the four-up dashboard row this card is made
          for (72rem less three 16px gaps, over four). The card sets its own
          width: a centred grid item otherwise shrinks to its content. */}
      <MetricCard
        className="w-full max-w-[17.25rem]"
        name={COPY.name}
        value={COPY.value}
        change={{ value: COPY.change, trend: "up", label: COPY.up }}
        description={COPY.period}
      />
    </>
  )
}

Examples

Dispute Ratemetric-card-dispute-rate

Example of the Metric Card: a falling dispute rate stat on a navy ground, with a note and two supporting figures. The metric card is a KPI stat tile for dashboards and analytics.

pnpm dlx shadcn add @01orbital/metric-card-dispute-rate

API reference

A card that shows one metric on a dashboard: its name, its value in large type, an optional change badge and an optional line of text below.

It takes no children. className and other props land on the Card.

Prop

Type

It also accepts the HTML attributes of the element it renders.

Dependencies

npm: @phosphor-icons/react. The CLI installs them for you.

Registry pieces it installs with it: