Before after pros cons — Comparison block

Pro

comparison-before-after-pros-cons · for home, landing pages

Before after pros cons

Two panels, "for whom" tinted and "not for whom" quiet: an honest statement of fit

Documentation

Installation

One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).

pnpm dlx shadcn-vue@latest add @trame/comparison-before-after-pros-cons

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import ComparisonBeforeAfterProsCons from '@/components/trame/blocks/comparison/comparison-before-after-pros-cons.vue'

const props = {
title: "Packing an order shouldn’t take all morning",
intro: "We timed how long a typical order took to pack, before and after switching to our tool.",
before: {
label: "Before",
items: [
{
text: "Copy the order into a spreadsheet",
value: "10 min"
},
{
text: "Check stock by hand",
value: "8 min"
}
],
total: "35 minutes per order",
count: 5,
unit: "manual steps"
},
after: {
label: "With our tool",
items: [
{
text: "The order arrives already entered",
value: "0 min"
},
{
text: "Stock counts itself down",
value: "0 min"
}
],
total: "1 minute per order",
count: 1,
unit: "step"
},
cta: {
label: "See how it works",
action: "page",
record: {
id: "fonctionnement"
}
},
footnote: "Measured on 40 orders packed in our workshop in March 2026."
}
</script>

<template>
<ComparisonBeforeAfterProsCons v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
title*stringWordsthe section’s title, an h2
introstringWordsone or two sentences under the title
before*Beforethe before side: who it is not for, or the old way
after*Afterthe after side: who it is for, or the new way
ctaCtathe call to action: its words and the page action it runs
footnotestringWordshow the figures were measured, and when
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Before before · 5 props
PropTypeDescription
label*stringWordsthe side’s heading ("Before", "With us", "Who it is for")
items*Item[]the after state’s items, in order
totalstringWordsthe sum or the conclusion of the side ("9 steps, half a day")
countnumberthe one figure of the side, in count-contrast (9), a number the merchant counted
unitstringWordswhat the figure counts ("steps"), after it
Item before.items[] · 2 props
PropTypeDescription
text*stringWordsone line, as the merchant would say it
valuestringWordswhat it costs or takes, as the merchant measured it ("2 h", "€14/month")
After after · 5 props
PropTypeDescription
label*stringWordsthe side’s heading ("Before", "With us", "Who it is for")
items*Item[]the after state’s items, in order
totalstringWordsthe sum or the conclusion of the side ("9 steps, half a day")
countnumberthe one figure of the side, in count-contrast (9), a number the merchant counted
unitstringWordswhat the figure counts ("steps"), after it
Item after.items[] · 2 props
PropTypeDescription
text*stringWordsone line, as the merchant would say it
valuestringWordswhat it costs or takes, as the merchant measured it ("2 h", "€14/month")
Cta cta · 3 props
PropTypeDescription
label*stringWordswhat happens ("See how it works")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
Options options · 2 props
PropTypeDescription
afterFirstbooleanon a phone, the "after" side comes first (when it is the point)
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa band of the page that redefines the theme surfaces inside it
What it asks your app for

The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
Linkyour router’s link component
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour word for an interface key, or undefined to keep the block’s own

The words it says itself, in English and French; label(key) replaces any of them:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo many attempts, try again in a moment.Trop de tentatives, réessayez dans un moment.

Features

  • Every word in the server HTML
  • Same markup in Vue and React
  • Theme tokens only: every theme, light and dark
  • Shows what you give it, invents nothing
  • Expressive motion, within its budget; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: cta

A comparison section, for home, landing pages; it uses @lucide/vue, class-variance-authority, clsx, motion, reka-ui, tailwind-merge.

Built with

The components this block is made of; each one installs on its own too.

More comparison blocks

  • Compare side by side: the two pictures whole, next to each other with "or" on the seam: two options or states to choose between, where a slider would hide half of each.
  • Compare split: the title and text beside the pictures, the legend under the words: the words explain what changed.
  • Compare wide: the title and text above, the two pictures across the page: a detail worth seeing large.
  • Cost bars: the merchant’s cost against another cost the merchant sourced, as two bars and a sentence: when a saving is real.
  • Fit matrix: options as columns and situations as rows with a mark per cell: compatibility, "this bag goes with…".
  • Head to head choice cards: 2 to 4 cards, each with its price, what it adds over the previous and its points: tiers, sizes and variants.
  • Head to head dimension rows: each criterion a row with the answers side by side in sentences: 3 to 6 dimensions that need words, not marks.
  • Head to head versus split: two panels, ours and the other, each a list of points grouped by theme: 4 to 8 points without a table feel.

All 15 comparison blocks