Table product columns — Comparison block

Pro

comparison-table-product-columns · for home, product, landing, catalog pages

Table product columns

Products side by side, each with its picture, price and link above its specifications: models, sizes, materials

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-table-product-columns

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import ComparisonTableProductColumns from '@/components/trame/blocks/comparison/comparison-table-product-columns.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>
<ComparisonTableProductColumns 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 ("Our bag against the others")
introstringWordsone or two sentences under the title
footnotestringWordswhere 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
verdictstringWordsthe merchant’s conclusion, honest about what the others do better
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Column columns[] · 9 props
PropTypeDescription
name*stringWordsthe option’s name: the merchant’s own product, a model, a size, a rival the merchant names
subtitlestringWordsone short line under the name
mediastringPicturethe option’s picture, when it is a product
altstringWordswhat the picture shows; empty when the name beside it says it
pricenumberDataits price in cents, from the merchant’s catalogue or own record
linkLinkthe link: its words and the page action it runs
notestringWordswhat this option adds over the previous one (choice-cards), in the merchant’s words
tagstringWordsa short label above the option, as the merchant chose it ("Our pick")
highlightbooleantrue: the column the merchant recommends, set apart
Link columns[].link · 3 props
PropTypeDescription
label*stringWordswhat happens ("See the model")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
Group groups[] · 2 props
PropTypeDescription
labelstringWordsthe group of criteria ("Material and making")
rows*Row[]the group’s rows, in order
Row groups[].rows[] · 3 props
PropTypeDescription
label*stringWordsthe criterion
hintstringWordsa short explanation of the criterion
cells*Cell[]one cell per column, in the columns’ order
Cell groups[].rows[].cells[] · 2 props
PropTypeDescription
kind*'text' | 'yes' | 'no' | 'partial' | 'dots'text: the words; yes, no, partial: a mark with its word; dots: 0 to 3 in value
valuestringWordsthe words of the cell, a short note beside a mark, or the dots’ count ("2")
Options options · 2 props
PropTypeDescription
stickybooleankeep the criteria column in view while a wide table scrolls (default true)
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
moneyformats a price, given in cents
asseta picture’s address as your app serves it
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
  • 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, catalog pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.

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