Product transformation slider — Storefront block

Pro

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

Usage

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.

PropTypeDescription
eyebrowstringWordsa short label above the title ("Why this jacket")
title*stringWordsthe section’s title: what makes the product worth it
before*stringPicturethe “before” picture, same frame as the “after”
after*stringPicturethe “after” picture, same frame
features*Feature[]3 to 6 features; more are fine, they continue as cards
closingstringWordsa closing line, a guarantee the merchant really gives
actionsAction[]the buttons under the before and after, each its words and page action
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Feature features[] · 3 props
PropTypeDescription
title*stringWordsthe selling point in a few words
body*stringWordsone or two sentences, the merchant’s own claim
iconstringDesignshield | leaf | sparkles | ruler | droplets | feather | wrench | heart | zap | package; sparkles when absent
Action actions[] · 3 props
PropTypeDescription
label*stringWordsthe words on the button or link
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
Options options · 4 props
PropTypeDescription
pictureRatio'landscape' | 'square' | 'portrait'the pictures’ frame (landscape by default)
beforeLabelstringWords("Before")
afterLabelstringWords("After")
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
  • 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.

All 409 storefront blocks