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.
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.jsonPrefer 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
| Prop | Type | Default | Description |
|---|---|---|---|
| badge | { label: string; variant?: BadgeVariant } | none | Pill above the heading; only rendered when badge is truthy. |
| heading | string | undefined | Section heading. |
| description | string | undefined | Section intro text. |
| metrics | ComparisonMetric[] | none | Metrics shown once per column, matched by array position. |
| className | string | none | Extra 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.
More Stats Blocks
View all →Simple Four Stat Row
A plain 4-column row of big numbers with labels, no icons or chrome.
Stats With Icons
Bordered stat tiles, each topped with a lucide icon above the number.
Big Hero Stat
One dominant, oversized stat with smaller supporting stats below it.
Stats With Progress Bars
A vertical list of stats, each paired with a horizontal progress bar toward a goal.
Animated Counter Row
A 4-stat row whose numbers count up from 0 on mount.
Dashboard Style Grid
A dense analytics-dashboard grid with trend deltas and inline sparklines.