Video ambient — Hero block

Free

hero-video-ambient · for home, landing pages

Video ambient

The film plays by itself, muted and in a loop, behind the words at the foot of the first screen, with a pause button and a "Watch the film" button for the whole film with its sound: a place, a craft or a product in use, shown before it is told; a short file of a few MB, the merchant’s own film only

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-video-ambient

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import HeroVideoAmbient from '@/components/trame/blocks/hero/hero-video-ambient.vue'

const props = {
title: "Learn to row on the river, from your first stroke to your first race",
subtitle: "Eight-week beginner courses, Saturday and Sunday mornings, boats and coaching included. Watch a dawn outing before you sign up.",
poster: "https://images.unsplash.com/photo-1569406125624-98ee19b01d4a?w=1600&q=80",
video: "/films/riverside.mp4",
primaryAction: {
label: "Join a beginner course",
action: "booking"
},
secondaryAction: {
label: "See the outings",
action: "page",
record: {
id: "programme"
}
},
speaker: {
name: "Sam Whitaker",
role: "head coach of the Riverside Rowing Club"
},
options: {
eyebrow: "A morning on the water",
note: "The film has English subtitles.",
alt: "A rowing eight in silhouette on golden water at dawn",
duration: "2 min",
mood: "inverse"
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe promise, in a sentence: the page’s h1
subtitlestringWordswhat the visitor gets and for whom, in one or two sentences
posterstringPicturethe picture shown before the film plays: a still of the film itself
video*stringPicturethe merchant’s own film: a file (.mp4,.webm) or the address of the player to embed; nothing is fetched before the visitor presses play, except in the ambient variant, where a file plays muted in a loop by itself once near the screen (a short film of a few MB at most)
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
speakerSpeakerthe person on screen
proofProofa social-proof line under the actions, an avatar stack beside one short line: the merchant’s own customers and figure only, never invented; hidden when absent
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
PrimaryAction primaryAction · 3 props
PropTypeDescription
label*stringWordswhat happens ("Book a class")
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 ("Book a class")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
Speaker speaker · 2 props
PropTypeDescription
name*stringWordsthe person on screen, by name, as the merchant gives it
rolestringWordswhat they do ("ceramicist and founder of the workshop")
Proof proof · 2 props
PropTypeDescription
avatars*Avatar[]three to five of the merchant’s own customers’ pictures
text*stringWordsthe merchant’s own figure, word for word ("16K+ happy clients")
Avatar proof.avatars[] · 3 props
PropTypeDescription
name*stringWordsthe avatar’s name
alt*stringWordswho the picture shows
srcstringPicturea picture: a root-relative path (/media/…) or an absolute URL
Options options · 5 props
PropTypeDescription
eyebrowstringWordsa short chip above the title ("The workshop film")
notestringWordsfine print under the actions
altstringWordsthe poster’s description, when it shows something the title does not say
durationstringWordsthe film’s length as the merchant wrote it ("2 min"), never computed
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
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: primaryAction, secondaryAction

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

  • Trio split: the promise in its own column beside the products, the first one tall and the others stacked next to it, names and prices laid on the pictures: one lead product backed by one or two companions.
  • Trio staggered: the promise above three featured products set at different heights: a small range the shop is proud of in full.
  • Trusted logo strip: a B2B opening whose proof is who already uses it: the merchant’s own logos under a thin rule.
  • Type centered: centred, the pictures under it in a row whose middle one stands taller: a launch, a calmer brand.
  • Type inline pictures: left-aligned, 1 to 3 of the pictures set inside the sentence at cap height (a pill, or overlapping circles), no strip: a team, a studio or a maker whose faces or objects belong in the sentence.
  • Type statement: left-aligned and huge, the text and the action on a rule under the statement, the pictures in a staggered strip: a brand with a voice.
  • Views stepper side: the words on the left with a numbered stepper under the actions, the chosen screen on the right running off the page: screens that follow an order (set up, run, report).
  • Views tabs over: the words centred, a row of pill tabs under the actions and the chosen screen in a wide frame below: a product whose screens weigh the same (planning, invoices, reports).

All 102 hero blocks