Preorder product split — Storefront block

Pro

storefront-preorder-product-split · for product, home, catalog pages

Preorder product split

The pre-order is the page’s subject: a large picture beside the date, the two payments side by side and the terms

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-preorder-product-split

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontPreorderProductSplit from '@/components/trame/blocks/storefront/storefront-preorder-product-split.vue'

const props = {
product: {
id: "veste-brume",
name: "Mist windbreaker jacket",
price: 24900,
image: "https://images.unsplash.com/photo-1591047139829-d91aecb6caea?w=1600&q=80",
alt: "An orange windbreaker on a hanger",
summary: "Lightweight nylon, ribbed collar and cuffs, two zip pockets. A single color for this first run."
},
title: "Preorder the Mist jacket",
expectedDate: "Ships from November 18",
payNow: 5000,
laterLabel: "The $199 balance is charged the day it ships, not before.",
made: 300,
action: "preorder.place",
actionLabel: "Preorder for $50",
policy: "Cancel free of charge, with your deposit refunded, until the day it ships.",
options: {
eyebrow: "Preorder",
nowLabel: "Today",
laterTitle: "When it ships",
madeLabel: "{count} made for this run"
}
}
</script>

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

Props

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

PropTypeDescription
product*ProductDatathe product open to pre-order; its price is the full price, in cents
titlestringWordsthe heading ("Preorder the Brume jacket"); the product’s name when absent
expectedDate*stringWordswhen it ships, in the merchant’s own words ("Shipping from 18 November"): never computed
payNow*numberDatawhat the customer pays today, in cents; the full price when the merchant charges everything now
laterLabelstringWordswhen and how the rest is charged ("The balance is charged on the day of shipping"); absent when everything is paid now
madenumberDatahow many were made, only when the merchant says so
action*stringActionthe page action that places the pre-order (posted as a form)
actionLabelstringWordswhat the button says ("Preorder")
policystringWordsthe merchant’s terms ("Free cancellation until shipping")
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Product product · 7 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
imagestring | nullPicturethe main picture; null or absent: the product has none yet
altstringWordswhat the main picture shows
summarystringWordsone short line on the product
Options options · 5 props
PropTypeDescription
eyebrowstringWordsthe tag ("Preorder")
nowLabelstringWordsthe name of the payment made today ("Today")
laterTitlestringWordsthe name of the later payment ("At shipping")
madeLabelstringWordshow the number made is said, {count} standing for it ("{count} copies made")
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: action
  • Reads products from your app

A storefront section, for product, home, catalog pages; it uses @lucide/vue, class-variance-authority, clsx, motion, reka-ui, tailwind-merge.

Built with

The components this block is made of; each one installs on its own too.

More storefront blocks

  • Payment trust line: directly under the pay button: one plain sentence and the accepted methods as chips.
  • Pickup picker points: relay points, lockers or shops: a home or pickup tab and a list of points with distance and hours.
  • Points ledger table: The customer wants to check a number: the full ledger of points earned and spent, with the balance after each line.
  • Points rewards affordable first: The customer has points to spend: the rewards to redeem, those they can afford first, the balance always in view.
  • Preorder products cards: a ship window, a reserved-of-total meter and a reserve button: a limited run in preorder; the merchant’s own products and figures only.
  • Preorder timeline steps: when the payment plan is the doubt (a deposit, a balance at shipping): the product small above, each step of the order drawn with its date and amount.
  • Price breakdown ruled bars: a ruled ledger, each line with its amount and a thin bar of its weight: the honest account of one price.
  • Price breakdown stacked bar: one segmented bar and its legend: 3 to 6 lines read at a glance.

All 409 storefront blocks