Guided configurator stepper — Storefront block

Pro

storefront-guided-configurator-stepper · for product pages

Guided configurator stepper

A product with three or more options that depend on each other: one step open at a time, each done step recapped, the picture above

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-guided-configurator-stepper

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontGuidedConfiguratorStepper from '@/components/trame/blocks/storefront/storefront-guided-configurator-stepper.vue'

const props = {
title: "Make it your own",
product: {
id: "gourde-75",
name: "Insulated bottle 25 oz",
price: 3900,
image: "https://images.unsplash.com/photo-1605714312496-01e90cb509cc?w=1600&q=80",
alt: "A white steel bottle"
},
steps: [
{
id: "couleur",
label: "Color",
kind: "swatch",
help: "Powder-coated, matte",
choices: [
{
id: "acier",
label: "Brushed steel",
color: "oklch(0.86 0.01 250)",
image: "https://images.unsplash.com/photo-1664714628878-9d2aa898b9e3?w=1600&q=80",
alt: "A brushed aluminum bottle with a black cap, on a gray background"
},
{
id: "sapin",
label: "Fir green",
color: "oklch(0.42 0.07 160)",
price: 500,
image: "https://images.unsplash.com/photo-1602143407151-7111542de6e8?w=1600&q=80",
alt: "A plain green insulated bottle"
}
]
},
{
id: "contenance",
label: "Capacity",
kind: "choice",
choices: [
{
id: "50",
label: "17 oz"
},
{
id: "75",
label: "25 oz"
}
]
}
],
addAction: "cart.add",
addLabel: "Add my bottle to cart",
note: "Made to order in five business days. An engraved bottle can’t be returned.",
options: {
eyebrow: "Custom",
summaryLabel: "Your selection",
baseLabel: "Bottle 25 oz",
continueLabel: "Continue",
editLabel: "Edit"
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe heading ("Make it your own")
product*ProductDatathe product being personalised; its price is the base price, in cents
steps*Step[]Datathe product’s options, in the order the visitor makes them
addAction*stringActionthe page action that receives the chosen options (posted as a form: product, then one field per step)
addLabelstringWordswhat the button says ("Add my bottle to the cart")
notestringWordswhat the merchant says about personalised items ("Made to order, not returnable")
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Product product · 5 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
price*numberan amount in cents
imagestring | nullPicturethe main picture; null or absent: the product has none yet
altstringWordswhat the main picture shows
Step steps[] · 11 props
PropTypeDescription
id*stringthe option’s key, posted as the field name
label*stringWordsthe step’s name ("Colour", "Engraving")
kind*'swatch' | 'choice' | 'text' | 'toggle'swatch: colours; choice: sizes or finishes as buttons; text: a free text shown on the picture; toggle: a yes/no extra (gift wrap)
helpstringWordsone line under the step’s name ("Up to 18 characters, capitals")
choicesChoice[]the choices offered, for kind swatch or choice
pricenumberfor text and toggle: what the option adds, in cents
placeholderstringWordsfor text: the field’s example ("Your initials")
valuestringWordsfor text: the words the field starts with; absent for an empty field
maxLengthnumberfor text: the number of characters
requiredbooleantrue: the visitor must answer this step before adding to the cart
preview'center' | 'top' | 'bottom'for text: where the words sit on the picture
Choice steps[].choices[] · 8 props
PropTypeDescription
id*stringthe choice’s key, posted as the field’s value
label*stringWordsthe choice’s name, e.g. "Forest green"
pricenumberwhat this choice adds to the price, in cents; absent when it is free
colorstringDesignthe swatch’s CSS colour, for kind swatch
imagestringPicturethe product picture for this choice (a colour’s picture), if the merchant has one
altstringWordswhat the choice’s picture shows
notestringWordsa short note ("Back in March")
unavailablebooleantrue: the choice is shown but cannot be picked
Options options · 6 props
PropTypeDescription
eyebrowstringWordsa small line above the heading
summaryLabelstringWordsthe heading of the recap ("Your selection")
baseLabelstringWordsthe line of the base price ("75 cl bottle")
continueLabelstringWordsthe button that opens the next step ("Continue")
editLabelstringWordsthe link that reopens a done step ("Edit")
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
moneyformats a price, given in cents
asseta picture’s address as your app serves it
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: addAction
  • Reads products from your app

A storefront section, for product pages; it uses @lucide/vue, @vueuse/core, 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

  • Gift card strip row: a short shelf closed by a gift card strip: for a visitor who would rather let the person choose.
  • Gift quiz entry card: one card inviting to the gift quiz beside a short shelf: a home page section that leads to the finder.
  • Gift shelves by recipient: pills for who the gift is for, a shelf of the shop’s products under each: a gift guide for a wide catalogue.
  • Guide with products tabs: Material selectors above numbered instructions and a matching product; the merchant's own guidance only.
  • Headline figures tiles: a product with three or four numbers that sell it (capacity, weight, size): the figures large in tiles, the full list in compact groups beneath.
  • Invoice details opt in card: company and invoice details in a bordered card under an opt-in checkbox, beside the merchant’s explanation, with optional host VAT validation: a professional buyer who needs an invoice in the company’s name.
  • Key dates tiles: each date on a large tile: a special period (extended returns, last order before the holidays).
  • Kit recommendation kits: Kits with their intended use and an explicitly supplied recommendation; the merchant's own pick only.

All 409 storefront blocks