Digital purchase split — Storefront block

Pro

storefront-digital-purchase-split · for product pages

Digital purchase split

The words and the buy box left, the deliverables card right: a digital or service product with nothing to photograph

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-digital-purchase-split

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontDigitalPurchaseSplit from '@/components/trame/blocks/storefront/storefront-digital-purchase-split.vue'

const props = {
product: {
id: "patron-brise",
name: "Brise bag sewing pattern, printable",
price: 1400,
currency: "USD",
summary: "The PDF pattern for the Brise bag, to sew at home, with its step-by-step assembly guide.",
description: "The complete Brise bag pattern: A0 sheets for a print shop or US letter sheets to tape together, the illustrated assembly guide, and the same instructions our workshops use.",
available: true,
facts: [
{
label: "Level",
value: "Intermediate"
},
{
label: "Format",
value: "A0, US letter and projector"
}
]
},
deliverables: [
{
label: "A0 sheets for a print shop",
meta: "PDF, 1.2 MB"
},
{
label: "US letter sheets to tape together",
meta: "PDF, 3.4 MB"
}
],
trust: [
"Instant download after purchase",
"License for personal use"
],
actions: {
add: "cart.add",
wishlist: "wishlist.add"
},
options: {
wishlistLabel: "Add to favorites"
}
}
</script>

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

Props

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

PropTypeDescription
product*ProductDatathe product, with its pictures, options and variants
breadcrumbBreadcrumb[]the path to the product, from the home page; its last item is the product itself, shown as the current page
deliverables*Deliverable[]what the buyer receives, for the no-picture-first variant
truststring[]Wordsa promise the merchant keeps ("Returns within 30 days")
actionsActionsthe page actions the block runs, each described below
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Product product · 22 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
price*numberan amount in cents
compareAtnumberthe price before the merchant’s reduction
currencystringDesignISO 4217, EUR by default
imagestring | nullPicturethe main picture; null or absent: the product has none yet
images(string | Image)[]its pictures: an address, or an address with what that picture shows (its own alt)
altstringWordswhat the main picture shows
brandstringWordsthe brand or maker
categorystringWordsthe product’s category, e.g. "Knitwear"
summarystringWordsone short line on the product
badgestringWordsa short tag the merchant set ("New", "Handmade")
ratingnumberthe average of the shop’s own stored reviews
reviewCountnumberhow many stored reviews the rating averages
availablebooleanfalse: sold out; true or absent: can be bought
stocknumberthe real stock, when the merchant shows it
maxQuantitynumberthe most one order may hold of it, as the merchant set it (one per customer, a limited run)
optionsOption[]the product’s options and their values, e.g. sizes
highlightsHighlight[]a few key facts the merchant set, shown on the product’s card
descriptionstringWordsthe product’s presentation, in the merchant’s words
factsFact[]the product’s key facts, each a property and its value, e.g. "Material": "Full-grain leather"
variantsVariant[]every combination of options the product comes in, with its own price and stock
Option product.options[] · 2 props
PropTypeDescription
name*stringWordsthe option’s name, e.g. "Size"
values*string[]Wordsits values, e.g. "S", "M", "L"
Highlight product.highlights[] · 2 props
PropTypeDescription
label*stringWordsthe property ("Material", "Capacity")
value*stringWordsits value, as the merchant states it ("Washed linen", "50 cl")
Fact product.facts[] · 2 props
PropTypeDescription
label*stringWords"Material"
value*stringWords"Full-grain leather"
Variant product.variants[] · 5 props
PropTypeDescription
id*string | numberthe variant’s id, sent with cart.add
options*Record<string, string>the value of each option for this variant, by option name, e.g. { "Colour": "Navy" }
pricenumberits own price in cents, when it differs
availablebooleanfalse: the variant is sold out
stocknumberthe variant’s real stock, when the merchant shows it
Breadcrumb breadcrumb[] · 4 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "See the collection"
actionstringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
urlstringDesignan address outside the app
Deliverable deliverables[] · 2 props
PropTypeDescription
label*stringWordswhat the buyer receives ("A0 pattern to print")
metastringWordsits type and size, as the merchant states it ("PDF, 2 MB")
Actions actions · 3 props
PropTypeDescription
add*stringActionthe action the add-to-cart form posts to
wishliststringActiona named action of the page
sizeGuidestringActiona named action of the page
Options options · 4 props
PropTypeDescription
wishlistLabelstringWords"Add to favourites"
sizeGuideLabelstringWords"Size guide"
optionWithSizeGuidestringWordsthe name of the option the size guide belongs to ("Size")
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
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: breadcrumb[], cart.add, actions.wishlist, actions.sizeGuide
  • 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

  • Daily board strip: a slim band with the date and the dishes side by side: a home page that mentions today’s list without giving it a whole screen.
  • Daily board: the day’s dishes written on a dark board with dotted leaders to their prices, the formula as a ticket at the bottom: a restaurant or bakery that changes its list every day.
  • Delivery options day strip: the merchant offers a choice of delivery day: a row of day cards with their price, unavailable days said in words.
  • Delivery options list: two to four ways to ship: rows with the price on the right and the arrival under the name.
  • Dispatch hubs: the merchant’s dispatch places, the regions each serves, and a few real figures.
  • Duties choice charges choice: cross-border orders: pay the duties now or on delivery, each with its exact amount beside a recap.
  • Exchange offer list: replacements in rows with their picture, price and stock, and a plain way out to a refund: a shop that prefers to exchange.
  • Express checkout wallets first: the shop offers wallet payment: wallets on top, then the card form below a divider.

All 409 storefront blocks