Product transformation slider — Storefront block
Prostorefront-product-transformation-slider · for product, landing pages
Product transformation slider
A product that transforms something (a stain, a repair, a finish): the list beside a before-after slider
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/storefront-product-transformation-sliderUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontProductTransformationSlider from '@/components/trame/blocks/storefront/storefront-product-transformation-slider.vue'
const props = {
eyebrow: "Why this bag",
title: "Made to last, designed to be repaired",
before: "https://images.unsplash.com/photo-1657603738389-951c374b740c?w=1600&q=80",
after: "https://images.unsplash.com/photo-1473188588951-666fce8e7c68?w=1600&q=80",
features: [
{
title: "Vegetable-tanned leather",
body: "Tanned with chestnut bark for six weeks: it develops a patina, it doesn’t crack.",
icon: "leaf"
},
{
title: "Saddle stitching",
body: "Two needles, one waxed thread: if one stitch gives, the rest holds.",
icon: "wrench"
}
],
closing: "Two-year warranty, parts and labor.",
actions: [
{
label: "See the warranty",
action: "page",
record: {
id: "garantie"
}
}
],
options: {
beforeLabel: "Before",
afterLabel: "After care"
}
}
</script>
<template>
<StorefrontProductTransformationSlider v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa short label above the title ("Why this jacket") |
| title* | string | Wordsthe section’s title: what makes the product worth it |
| before* | string | Picturethe “before” picture, same frame as the “after” |
| after* | string | Picturethe “after” picture, same frame |
| features* | Feature[] | 3 to 6 features; more are fine, they continue as cards |
| closing | string | Wordsa closing line, a guarantee the merchant really gives |
| actions | Action[] | the buttons under the before and after, each its words and page action |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Feature features[] · 3 props
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe selling point in a few words |
| body* | string | Wordsone or two sentences, the merchant’s own claim |
| icon | string | Designshield | leaf | sparkles | ruler | droplets | feather | wrench | heart | zap | package; sparkles when absent |
Action actions[] · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens, if any |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| pictureRatio | 'landscape' | 'square' | 'portrait' | the pictures’ frame (landscape by default) |
| beforeLabel | string | Words("Before") |
| afterLabel | string | Words("After") |
| 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
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
actions[]
A storefront section, for product, landing pages; it uses @lucide/vue, class-variance-authority, clsx, reka-ui, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More storefront blocks
- Product story chapters: the buy card first, beside one picture, then the story as numbered chapters with picture and words alternating sides: a product bought on its specification first, whose story rewards those who scroll on.
- Product story immersive: a full-width hero picture with the story in tabs and the buy panel raised below it: a product with one strong photograph and more to tell.
- Product story sticky story: pictures and short paragraphs scroll beside a buy card that stays in view: a craft or premium product with something to tell.
- Product test results scored list: a product the merchant tested (weather, wear, battery): scenarios with a five-dot score and the result in words.
- Product trust facts inline: one dotted line under the button: when the shop has one or two short facts and the buy box is already full.
- Product trust facts list: icon lines under the buy button, one fact per line: the usual place for delivery, returns and guarantee.
- Product trust facts tiles: a 2 by 2 grid of small cards with a big figure and a caption: when the facts are numbers worth reading at a glance.
- Product upgrade comparison: the product they have beside the one a step up, the differences in bold, keep or trade up: a considered upgrade.