Slider peek — Hero block

Free

hero-slider-peek · for home pages

Slider peek

The current slide centred with the previous and next showing as slivers at the edges: 3 to 5 scenes of equal weight, where showing that there is more is the point

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-slider-peek

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import HeroSliderPeek from '@/components/trame/blocks/hero/hero-slider-peek.vue'

const props = {
slides: [
{
image: "https://images.unsplash.com/photo-1515886657613-9f3515b0c78f?w=1600&q=80",
alt: "A yellow tracksuit on a seaside basketball court",
title: "Summer starts here",
text: "Light pieces, designed to last more than one season.",
action: {
label: "See the collection",
action: "collection",
record: {
id: "ete"
}
}
},
{
image: "https://images.unsplash.com/photo-1512436991641-6745cdb1723f?w=1600&q=80",
alt: "A rack of shirts and jackets in soft colors",
title: "Organic cotton basics",
text: "Cut and sewn in small batches, restocked all year.",
action: {
label: "Discover the basics",
action: "collection",
record: {
id: "basiques"
}
},
align: "end"
}
]
}
</script>

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

Props

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

PropTypeDescription
slides*Slide[]2 to 5 slides, the first screen’s strongest pictures; a sixth is never shown
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Slide slides[] · 6 props
PropTypeDescription
image*stringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows, when the words do not say it (empty: decorative)
title*stringWords3 to 8 words; the first slide’s is the page’s h1
textstringWordsone sentence
actionActionthe slide’s call to action: its words and the page action
align'start' | 'center' | 'end'fullbleed: the picture’s calm side, where the words sit (start by default)
Action slides[].action · 3 props
PropTypeDescription
label*stringWordswhat happens ("See the collection")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens (a category), if any
Options options · 2 props
PropTypeDescription
height'tall' | 'medium'tall (by default): most of the first screen; medium: about two thirds
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: slides[].action

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

  • Signature corner tiles: one full-bleed picture with the promise at its lower left and the pieces as small picture tiles in the lower-right corner: fashion or accessories, where the picture is the argument and the products a discreet addition.
  • Signature product rail: a large picture with the promise at its foot and the two or three pieces stacked in a dark column beside it: a shop that wants the promise and the way to buy in the same first screen.
  • Signature scene card: a framed scene with the promise at its left and one piece’s card standing on the right, arrows to switch between pieces: a lifestyle shop whose products are shown in a room, not cut out.
  • Signature split card: a magazine-like split: a tall picture with one product’s card resting on it: a shop with one hero product or a signature piece.
  • Split backdrop: one strong picture fills the whole section behind the words, which stand on one side over a dark scrim: a house for sale, a hotel, a place or a trip that sells itself by its view — the merchant’s own only.
  • Split collage: three to five framed pictures, slightly turned and overlapping, beside the words: a lifestyle app, a community, a brand with many faces — the merchant’s own only.
  • Split image: a plain picture beside the words, with an optional caption card: a product or a place seen at first glance — the merchant’s own only.
  • Split notched: the words above one wide landscape picture whose corners are cut out as notches holding the actions and the caption: an architect, a venue, a hotel whose one strong picture should feel cut into the page — the merchant’s own only.

All 102 hero blocks