Head to head versus split — Comparison block
Procomparison-head-to-head-versus-split · for home, product, landing pages
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
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-head-to-head-versus-splitUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import ComparisonHeadToHeadVersusSplit from '@/components/trame/blocks/comparison/comparison-head-to-head-versus-split.vue'
const props = {
title: "Our bag vs. the rest",
intro: "What matters in a bag you carry every day, including the points where we are not the best.",
footnote: "Specs taken in May 2026 from each brand’s public product pages. Prices are those listed on that date.",
verdict: "If you want the lightest or the cheapest, another brand will suit you better; if the bag has to last and be repairable, ours is the one.",
columns: [
{
name: "Atelier 24h",
subtitle: "Our city bag",
media: "https://images.unsplash.com/photo-1657603738389-951c374b740c?w=1600&q=80",
alt: "A brown leather bag",
price: 18900,
tag: "Our bag",
highlight: true,
link: {
label: "See the bag",
action: "product",
record: {
id: "atelier-24h"
}
},
note: "The everyday bag"
},
{
name: "Brand A",
subtitle: "Coated canvas bag",
media: "https://images.unsplash.com/photo-1602845860431-35374f24f48d?w=1600&q=80",
alt: "A mustard canvas backpack with leather straps, resting in the grass",
price: 12900,
link: {
label: "See at Brand A",
action: "product",
record: {
id: "a"
}
},
note: "Cheaper, less durable"
}
],
groups: [
{
label: "Craftsmanship",
rows: [
{
label: "Full-grain leather",
hint: "No plastic finish coating",
cells: [
{
kind: "yes"
},
{
kind: "no"
}
]
},
{
label: "Made in the USA",
cells: [
{
kind: "yes",
value: "Workshop in Portland"
},
{
kind: "no"
}
]
}
]
},
{
label: "In use",
rows: [
{
label: "Empty weight",
cells: [
{
kind: "text",
value: "1.8 lb"
},
{
kind: "text",
value: "1.4 lb"
}
]
},
{
label: "Laptop compartment",
hint: "Up to 15 inches",
cells: [
{
kind: "yes",
value: "15\""
},
{
kind: "yes",
value: "13\""
}
]
}
]
}
]
}
</script>
<template>
<ComparisonHeadToHeadVersusSplit v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe section’s title, an h2 ("Our bag against the others") |
| intro | string | Wordsone or two sentences under the title |
| footnote | string | Wordswhere the figures come from and the date, as the merchant wrote it ("Checked in May 2026 on the brands’ websites") |
| columns* | Column[] | the columns shown, in order |
| groups* | Group[] | the groups shown, in order |
| verdict | string | Wordsthe merchant’s conclusion, honest about what the others do better |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Column columns[] · 9 props
| Prop | Type | Description |
|---|---|---|
| name* | string | Wordsthe option’s name: the merchant’s own product, a model, a size, a rival the merchant names |
| subtitle | string | Wordsone short line under the name |
| media | string | Picturethe option’s picture, when it is a product |
| alt | string | Wordswhat the picture shows; empty when the name beside it says it |
| price | number | Dataits price in cents, from the merchant’s catalogue or own record |
| link | Link | the link: its words and the page action it runs |
| note | string | Wordswhat this option adds over the previous one (choice-cards), in the merchant’s words |
| tag | string | Wordsa short label above the option, as the merchant chose it ("Our pick") |
| highlight | boolean | true: the column the merchant recommends, set apart |
Link columns[].link · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat happens ("See the model") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens, if any |
Group groups[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label | string | Wordsthe group of criteria ("Material and making") |
| rows* | Row[] | the group’s rows, in order |
Row groups[].rows[] · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe criterion |
| hint | string | Wordsa short explanation of the criterion |
| cells* | Cell[] | one cell per column, in the columns’ order |
Cell groups[].rows[].cells[] · 2 props
| Prop | Type | Description |
|---|---|---|
| kind* | 'text' | 'yes' | 'no' | 'partial' | 'dots' | text: the words; yes, no, partial: a mark with its word; dots: 0 to 3 in value |
| value | string | Wordsthe words of the cell, a short note beside a mark, or the dots’ count ("2") |
Options options · 1 props
| Prop | Type | Description |
|---|---|---|
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a 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).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| money | formats a price, given in cents |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your 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:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too 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
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
columns[].link
A comparison section, for home, product, landing pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.
More comparison blocks
- 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…".
- Table figures: each option’s value set large in a column, rows parted by thin rules, the chosen option carried by its tag: comparisons whose cells are numbers (weight, time, price, cost per use) where the contrast must be seen — the merchant’s own figures only.
- Table product columns: products side by side, each with its picture, price and link above its specifications: models, sizes, materials.
- Table tabs vs: our option against one alternative at a time, picked from a tab bar: many comparisons in one section.
- Table: a classic grid of criteria against 2 to 4 options, one column tinted: a decision made row by row.