Staaarter

Before After Comparison

Two-column comparison section listing the same set of metrics twice, once under 'Before' and once under 'After'. The after column uses a primary-colored border and text to draw the eye to the improved numbers. Useful for case studies, migration write-ups, and product-change recaps.

By Staaarter Team
Stats
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/before-after-comparison.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/stats/stats7.tsx instead.

Usage

The file also exports stats7Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Stats7, stats7Demo } from "@/components/blocks/stats/stats7";

export default function Page() {
  return <Stats7 {...stats7Demo} />;
}

Props

PropTypeDefaultDescription
badge{ label: string; variant?: BadgeVariant }nonePill above the heading; only rendered when badge is truthy.
headingstringundefinedSection heading.
descriptionstringundefinedSection intro text.
metricsComparisonMetric[]noneMetrics shown once per column, matched by array position.
classNamestringnoneExtra classes for the outer section element.

Types

type ComparisonMetric = {
  label: string;
  before: string;
  after: string;
};

Behavior notes

  • This block is entirely static and decorative: the two columns simply render the same metrics list twice with different styling, there is no computed delta or animation.
  • The badge/heading/description header block only renders when at least one of the three is set.
  • Visual distinction between columns (the After column's border-primary/text-primary treatment) is purely styling; it does not evaluate whether after is actually better than before.