Image overlay — Hero block
Prohero-image-overlay · for home, catalog, landing pages
Image overlay
One strong, wide picture of the shop’s own: the title and the action laid over it on a legible wash, the picture across the whole width
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-image-overlayUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import HeroImageOverlay from '@/components/trame/blocks/hero/hero-image-overlay.vue'
const props = {
title: "Jackets that hold up in the rain",
lead: "Cut from coated canvas in Portland, sewn and heat-sealed to stay dry from fall to spring.",
image: "https://images.unsplash.com/photo-1694561418303-16393986b86d?w=1600&q=80",
alt: "A man in profile wearing a dark green hooded rain jacket by a misty lake",
action: {
label: "See rain jackets",
action: "collection",
record: {
id: "vestes-pluie"
}
}
}
</script>
<template>
<HeroImageOverlay v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe shop’s promise in a few words: the page’s h1 ("Jackets that hold up in the rain") |
| lead | string | Wordsone or two sentences under the title, in the merchant’s words |
| image* | string | Picturethe one picture the page opens on: the shop’s own, wide enough to crop |
| alt | string | Wordswhat the picture shows, in a sentence; empty or missing when the words already say it (decorative) |
| action | Action | the call to action: its words and the page action it runs |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Action action · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat happens ("See the collection") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens (a collection), if any |
Options options · 3 props
| Prop | Type | Description |
|---|---|---|
| height | 'tall' | 'medium' | how much of the first screen the picture takes: "tall" (the default) nearly all of it, "medium" about two thirds |
| align | 'start' | 'center' | where the words sit: at the start (the default) or centred |
| 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 |
| asset | a picture’s address as your app serves it |
| 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
- Expressive motion, within its budget; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
action
A hero section, for home, catalog, landing pages; it uses @lucide/vue, class-variance-authority, clsx, motion, reka-ui, tailwind-merge.
More hero blocks
- Float scatter: the pictures around the title at different sizes and depths, as if set down on a table: 3 or 4 products that read well alone.
- Flows workflow tabs: a product explained by its flows: centred words over a tab row, each tab a short chain of steps.
- Form card: the promise and what the visitor gets on one side, a framed form panel on the other: a quote or a demo that asks a few questions.
- Globe beside: a team, a network of makers or depots, with more to say: the words at the left and a whole dotted globe at the right, its first places named on leaders; the merchant’s own places only.
- Globe rising: a brand whose argument is where it makes or ships, told in few words: the words centred over a large dotted hemisphere rising from the bottom edge, its pins named on hover and listed under it; the merchant’s own places only.
- Marquee columns side: the promise on the start side, beside two or three columns of pictures scrolling slowly up and down in opposite directions (still below the expressive level, a short still grid on a phone): a studio, a maker or a shop whose body of work is the argument and wants its words read first, the pictures as a living gallery beside them (the merchant’s own work or products only).
- Marquee cylinder: the promise centred above one row of pictures laid on the inside of a cylinder, flat at the centre and curling toward the visitor at both ends, streaming slowly sideways (a still curve below the expressive level): a studio or a product whose body of work is the argument and wants one striking, immersive picture rail rather than two plain rows (the merchant’s own work or products only).
- Marquee rows: the promise centred above two full-width rows of pictures sliding slowly in opposite directions (one row under six pictures), still below the expressive level: a studio, a maker or a shop whose body of work is the argument (the merchant’s own work or products only).