Product configurator side by side — Storefront block
Prostorefront-product-configurator-side-by-side · for product pages
Product configurator side by side
A made-to-order page of its own: the picture stays in view on one side while every option runs down the other, the recap at the end
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-configurator-side-by-sideUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontProductConfiguratorSideBySide from '@/components/trame/blocks/storefront/storefront-product-configurator-side-by-side.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 water 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 the cart",
note: "Made to order in five business days. An engraved bottle cannot be returned.",
options: {
eyebrow: "Custom",
summaryLabel: "Your selection",
baseLabel: "Bottle 25 oz"
}
}
</script>
<template>
<StorefrontProductConfiguratorSideBySide v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe heading ("Make it your own") |
| product* | Product | Datathe 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* | string | Actionthe page action that receives the chosen options (posted as a form: product, then one field per step) |
| addLabel | string | Wordswhat the button says ("Add my bottle to the cart") |
| note | string | Wordswhat the merchant says about personalised items ("Made to order, not returnable") |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Product product · 5 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe product’s name |
| price* | number | an amount in cents |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| alt | string | Wordswhat the main picture shows |
Step steps[] · 11 props
| Prop | Type | Description |
|---|---|---|
| id* | string | the option’s key, posted as the field name |
| label* | string | Wordsthe 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) |
| help | string | Wordsone line under the step’s name ("Up to 18 characters, capitals") |
| choices | Choice[] | the choices offered, for kind swatch or choice |
| price | number | for text and toggle: what the option adds, in cents |
| placeholder | string | Wordsfor text: the field’s example ("Your initials") |
| value | string | Wordsfor text: the words the field starts with; absent for an empty field |
| maxLength | number | for text: the number of characters |
| required | boolean | true: 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
| Prop | Type | Description |
|---|---|---|
| id* | string | the choice’s key, posted as the field’s value |
| label* | string | Wordsthe choice’s name, e.g. "Forest green" |
| price | number | what this choice adds to the price, in cents; absent when it is free |
| color | string | Designthe swatch’s CSS colour, for kind swatch |
| image | string | Picturethe product picture for this choice (a colour’s picture), if the merchant has one |
| alt | string | Wordswhat the choice’s picture shows |
| note | string | Wordsa short note ("Back in March") |
| unavailable | boolean | true: the choice is shown but cannot be picked |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa small line above the heading |
| summaryLabel | string | Wordsthe heading of the recap ("Your selection") |
| baseLabel | string | Wordsthe line of the base price ("75 cl bottle") |
| 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 |
| money | formats a price, given in cents |
| asset | a picture’s address as your app serves it |
| 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:
addAction - Reads
productsfrom 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
- Product close ups loupes: each detail in a round close-up like a magnifying glass, set in staggered balanced rows with its name and note under it, the piece itself in a card at the head: three to twelve details of a crafted piece (leather, knitwear, ceramics).
- Product compare cards above: product cards over a grouped table whose header stays in view: a large range with many attributes.
- Product compare swipe: phone-first: columns scroll sideways and snap, the attribute names pinned; chosen automatically beyond four products.
- Product compare table: two to four models side by side in a plain grid, the current one tinted: the usual comparison of a small range.
- Product dimensions diagram: A dimension drawing with exact measurements, enlarged in a dialog with an all-media tab; the merchant’s own only.
- Product facets radial: one product with 3 to 6 named facets around its picture: a single object seen from several sides.
- Product features accordion picture: a few features that each deserve a sentence: a picture beside an accordion, the picture following the open panel.
- Product features alternating: the usual story of a product: a picture and a selling point per row, sides swapping each time.