Skip to main content
Clever Ops

Stats Compare

Before-and-after metrics in two hairline columns, each row pairs the old number with the new one and settles a delta chip that quantifies the improvement.

Preview & code

Loading Stats Compare preview

Installation

pnpm dlx shadcn@latest add @cleverui/stats-compare

Requires the @cleverui registry in your components.json, a one-off, two-line setup.

Usage

tsx
import { StatsCompare } from '@/components/blocks/stats-compare'
Exampletsx
import { StatsCompare } from '@/components/blocks/stats-compare'

export default function StatsCompareDemo() {
  return (
    <div className="mx-auto max-w-6xl">
      <StatsCompare
        heading="What changed after Meridian"
        beforeLabel="Before"
        afterLabel="After"
        rows={[
          {
            metric: 'Invoice cycle time',
            before: '11.4 days',
            after: '2.1 days',
            delta: '−82%',
            positive: true,
          },
          {
            metric: 'Manual reconciliations / week',
            before: '148',
            after: '12',
            delta: '−92%',
            positive: true,
          },
          {
            metric: 'Exception escalation rate',
            before: '18%',
            after: '3.2%',
            delta: '−82%',
            positive: true,
          },
          {
            metric: 'Ops hours spent chasing POs',
            before: '62 h',
            after: '9 h',
            delta: '−53 h',
            positive: true,
          },
          {
            metric: 'Close-day overtime',
            before: '14 h',
            after: '1.5 h',
            delta: '−89%',
            positive: true,
          },
        ]}
        footnote="Median across 120 migrations · Meridian Ops Platform"
      />
    </div>
  )
}

API reference

StatsCompare accepts the following props.

PropTypeDefaultDescription
headingstring'What changed'
beforeLabelstring'Before'
afterLabelstring'After'
rows*StatsCompareRow[]3–6 rows
footnotestringmono methodology line

…plus everything from React.HTMLAttributes<HTMLElement>: className, event handlers, aria attributes and the rest pass straight through.

Referenced types

Typestsx
export interface StatsCompareRow {
  metric: string
  before: string
  after: string
  /** preformatted, e.g. '-64%' */
  delta: string
  /** marks improvements regardless of sign direction */
  positive?: boolean
}

Frequently asked questions

How do I install the Stats Compare component?

Register the @cleverui registry in your components.json ("@cleverui": "https://cleverops.com.au/r/{name}.json"), then run `npx shadcn@latest add @cleverui/stats-compare`. The shadcn CLI copies the source into your project, you own the code from that point. You can also copy the source directly from this page.

What dependencies does Stats Compare require?

Stats Compare uses motion and lucide-react on top of React and Tailwind CSS. You don't need to install them manually, the shadcn CLI resolves and installs npm dependencies automatically when you add the component.

Can I theme Stats Compare to match my brand?

Yes. The component is styled entirely with Tailwind utilities over standard design tokens (primary, background, muted, border), so it inherits your existing shadcn/ui theme automatically. Change your CSS variables and the component follows, no source edits needed for palette, radius, or fonts.

Want this built for you?

CleverUI is built by the Clever Ops web team. If you'd rather ship a hand-coded, fast, custom website than assemble one, we build them for Australian businesses every week.

Explore web development services