Colorways swatch stage — Hero block

Pro

hero-colorways-swatch-stage · for home, landing pages

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)

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-colorways-swatch-stage

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import HeroColorwaysSwatchStage from '@/components/trame/blocks/hero/hero-colorways-swatch-stage.vue'

const props = {
title: "The linen sheet, in four shades",
lead: "Woven in Maine, washed in the workshop, cut to your measurements. Choose the shade that suits your bedroom.",
finishes: [
{
name: "Ecru",
image: "https://images.unsplash.com/photo-1528458909336-e7a0adfed0a5?w=1600&q=80",
swatch: "https://images.unsplash.com/photo-1528458909336-e7a0adfed0a5?w=160&h=160&fit=crop&q=70",
alt: "Ecru linen seen up close, its weave clearly visible",
note: "The color of the thread before dyeing: it gently lightens in the sun.",
product: {
id: "drap-lin-ecru",
name: "Washed linen flat sheet",
price: 12900,
available: true
}
},
{
name: "Crinkled ecru",
image: "https://images.unsplash.com/photo-1588610992315-5654831ceebd?w=1600&q=80",
swatch: "https://images.unsplash.com/photo-1588610992315-5654831ceebd?w=160&h=160&fit=crop&q=70",
alt: "Crinkled ecru linen in wide folds",
note: "Washed twice in the workshop for a softer drape from the very first night.",
product: {
id: "drap-lin-froisse",
name: "Washed linen flat sheet",
price: 13900,
available: true
}
}
],
action: {
label: "See all bed linen",
action: "collection",
record: {
id: "linge-de-lit"
}
},
options: {
eyebrow: "New shades"
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe piece’s promise, 2 to 8 words: the page’s h1 ("The linen sheet, in four shades")
leadstringWordsone or two sentences on the piece
finishes*Finishe[]two to eight colours or finishes of one piece, the first shown first
actionActionthe call to action: its words and the page action it runs
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Finishe finishes[] · 6 props
PropTypeDescription
name*stringWordsthe colour or finish as the merchant names it ("Petrol blue", "Oiled walnut")
image*stringPicturethe piece in this finish, a tall picture
alt*stringWordswhat the picture shows, in a sentence
swatchstringPicturea small picture of the colour or the material itself; without one the picture is cropped
notestringWordsone line on this finish, in the merchant’s words ("Piece-dyed, it softens with washing")
product*ProductDatathe piece in this finish, as the catalogue tool answers it
Product finishes[].product · 6 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
price*numberan amount in cents
compareAtnumberthe price before the merchant’s reduction
currencystringDesignISO 4217, EUR by default
availablebooleanfalse: sold out; true or absent: can be bought
Action action · 3 props
PropTypeDescription
label*stringWordsa second way in ("See the whole collection")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens (a collection)
Options options · 2 props
PropTypeDescription
eyebrowstringWordsa short line over the title ("New shades")
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
  • Expressive motion, within its budget; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: action
  • Reads products from your app

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

More hero blocks

  • Bundle kit: a bundle of two to five pieces: what is in it, what it costs bought apart, and what the kit saves.
  • Capabilities chips: many small capabilities: a row of chips under the actions says what the product covers at a glance.
  • 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.
  • Comparison versus: an honest comparison with the usual alternative, row by row, the source stated by the merchant.
  • 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.

All 102 hero blocks