Comparison versus — Hero block

Pro

hero-comparison-versus · for home, landing, product pages

Comparison versus

An honest comparison with the usual alternative, row by row, the source stated by the merchant

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/hero-comparison-versus

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import HeroComparisonVersus from '@/components/trame/blocks/hero/hero-comparison-versus.vue'

const props = {
title: "The first run of our travel bag, on preorder while it lasts",
subtitle: "One hundred fifty pieces sewn by hand, shipped in order of reservation. You only pay a deposit today.",
points: [
{
title: "Hand-sewn",
text: "One person makes it, from cutting to final inspection."
},
{
title: "Refundable",
text: "Cancel anytime before it ships."
}
],
primaryAction: {
label: "Preorder · $189",
action: "product",
record: {
id: "sac-voyage"
}
},
secondaryAction: {
label: "See details",
action: "page",
record: {
id: "details"
}
},
columns: {
a: "Our bag",
b: "A mass-market bag"
},
rows: [
{
label: "Canvas",
a: "Waxed cotton, 14 oz",
b: "Coated polyester"
},
{
label: "Seams",
a: "Linen thread, saddle stitch",
b: "Synthetic thread, machine-sewn"
}
],
options: {
eyebrow: "Numbered series",
note: "Comparison made by us from the product sheets of three bags sold in big-box stores.",
panelTitle: "How production is going"
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe offer’s promise, in a sentence
subtitlestringWordswhat it is and how it works, in one or two sentences
pointsPoint[]the points shown, in order
primaryAction*PrimaryActionthe main button: its words and the page action it runs
secondaryActionSecondaryActiona quieter second action beside the main one: its words and the page action
columns*Columnsthe two columns’ headings: this product and the usual alternative
rows*Row[]the rows shown, in order
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Point points[] · 2 props
PropTypeDescription
title*stringWordsa reason, a few words
textstringWordsone line to back it
PrimaryAction primaryAction · 3 props
PropTypeDescription
label*stringWordswhat happens ("Preorder · €189")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
SecondaryAction secondaryAction · 3 props
PropTypeDescription
label*stringWordswhat happens ("Preorder · €189")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
Columns columns · 2 props
PropTypeDescription
a*stringWordsthis product
b*stringWordsthe usual alternative
Row rows[] · 3 props
PropTypeDescription
label*stringWordswhat is compared
a*stringWordsthis product
b*stringWordsthe alternative
Options options · 5 props
PropTypeDescription
eyebrowstringWordsa short chip above the title
notestringWordswhere the comparison comes from
panelTitlestringWordsthe heading of the panel ("Where the making stands")
background'aurora' | 'pattern' | 'none'the section’s background: aurora, pattern, none
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: primaryAction, secondaryAction
  • Reads products from your app

A hero section, for home, landing, product 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 hero blocks

  • Centered framed: the same centred promise set inside a bordered panel with corner marks, the eyebrow as a tab on its edge and the fine print along its foot: a launch or an announcement that should read like a printed notice.
  • Centered minimal: a type-first opening for a product or a launch: a very large promise whose last words take the theme gradient, on a fine grid, standing on a glowing horizon arc at the foot.
  • Colorways split list: the words and the colours as a list of named rows at the left, each with its swatch and price, the piece tall at the right and wiping to the chosen colour: colours whose names, notes and prices differ and deserve to be read.
  • Colorways swatch stage: the title centred over a wide stage holding the chosen colour, the swatches in a pill at its foot and the chosen piece’s card in its corner: a shop that opens on one piece whose colours are the news (a new dye, a season’s palette).
  • Diagram fan: a platform with many connections: centred words and a still fan of thin lines from the product to the tools below.
  • Diagram hub: a product that plugs into the tools a buyer already has: the words beside a hub with its real integrations, joined by a moving beam.
  • Duo framed captions: two rounded frames on a dark band, a product card on each picture and the title with its link under the frame: a quieter, gallery-like opening.
  • Duo full panels: two tall pictures edge to edge, each title large over its foot and a product chip in its corner: a shop with two strong scenes that opens on two doors.

All 102 hero blocks