Campfire
Registry

Metric Card

A headline number with label and optional delta.

<MetricCard value="42%" label="Activation lift" delta="+18%" />
<MetricCard value="1,200" label="Teams onboarded" />

Installation

camp add metric-card

Or with any shadcn-compatible CLI:

bunx shadcn@latest add https://campfire-deck.vercel.app/r/metric-card.json

Copy the source into components/metric-card.tsx. It imports cn from @/lib/utils — scaffolded by camp init, or camp add utils:

components/metric-card.tsx
import type { ComponentProps } from "react";
import { cn } from "@/lib/utils";

export type MetricCardProps = ComponentProps<"div"> & {
  /** The headline number, e.g. "42%". */
  value: string;
  /** What the number measures. */
  label: string;
  /** Optional change indicator rendered beside the value, e.g. "+18%". */
  delta?: string;
};

/** A headline number with label and optional delta. */
export default function MetricCard({
  value,
  label,
  delta,
  className,
  ...props
}: MetricCardProps) {
  return (
    <div
      className={cn(
        "inline-flex flex-col gap-1 rounded-2xl border border-foreground/10 bg-foreground/[0.03] px-8 py-6",
        className
      )}
      data-slot="metric-card"
      {...props}
    >
      <span className="flex items-baseline gap-3" data-slot="metric-card-value">
        <span className="font-bold font-heading text-6xl tracking-tight">
          {value}
        </span>
        {delta ? (
          <span
            className="font-medium text-primary text-xl"
            data-slot="metric-card-delta"
          >
            {delta}
          </span>
        ) : null}
      </span>
      <span className="text-lg opacity-60" data-slot="metric-card-label">
        {label}
      </span>
    </div>
  );
}

Usage

Components are auto-discovered from components/ — use them in any slide, no imports:

slides/05-metrics.mdx
---
title: Metrics
---

## Primitives, not screenshots

<MetricCard value="42%" label="Activation lift" delta="+18%" />

API Reference

Extends ComponentProps<"div"> — native props are forwarded and className is merged last. Parts expose data-slot="metric-card", metric-card-value, metric-card-delta, and metric-card-label for theme-level styling.

Prop

Type

On this page