Preorder banner — Storefront block
Prostorefront-preorder-banner · for product, home, catalog pages
Preorder banner
A pre-order announced between two sections or above a product page: the picture, the date, what is paid now, one button
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-bannerUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontPreorderBanner from '@/components/trame/blocks/storefront/storefront-preorder-banner.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>
<StorefrontPreorderBanner v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| product* | Product | Datathe product open to pre-order; its price is the full price, in cents |
| title | string | Wordsthe heading ("Preorder the Brume jacket"); the product’s name when absent |
| expectedDate* | string | Wordswhen it ships, in the merchant’s own words ("Shipping from 18 November"): never computed |
| payNow* | number | Datawhat the customer pays today, in cents; the full price when the merchant charges everything now |
| laterLabel | string | Wordswhen and how the rest is charged ("The balance is charged on the day of shipping"); absent when everything is paid now |
| made | number | Datahow many were made, only when the merchant says so |
| action* | string | Actionthe page action that places the pre-order (posted as a form) |
| actionLabel | string | Wordswhat the button says ("Preorder") |
| policy | string | Wordsthe merchant’s terms ("Free cancellation until shipping") |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Product product · 7 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 |
| compareAt | number | the price before the merchant’s reduction |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| alt | string | Wordswhat the main picture shows |
| summary | string | Wordsone short line on the product |
Options options · 5 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsthe tag ("Preorder") |
| nowLabel | string | Wordsthe name of the payment made today ("Today") |
| laterTitle | string | Wordsthe name of the later payment ("At shipping") |
| madeLabel | string | Wordshow the number made is said, {count} standing for it ("{count} copies made") |
| 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:
action - Reads
productsfrom 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 retry facts list: a payment that did not go through: the facts of the attempt, what happens next, retry or change the method.
- 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.