Fulfilment choice cards — Storefront block

Pro

storefront-fulfilment-choice-cards · for product pages

Fulfilment choice cards

A product that can be delivered or picked up: a switch and the stores with their distance and stock

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-fulfilment-choice-cards

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontFulfilmentChoiceCards from '@/components/trame/blocks/storefront/storefront-fulfilment-choice-cards.vue'

const props = {
title: "Ship or pick up",
product: {
id: "velo",
name: "City helmet",
price: 7900
},
modes: [
{
id: "std",
label: "Home delivery",
price: 0,
note: "Delivered in 2 to 4 business days"
},
{
id: "exp",
label: "Express delivery",
price: 590,
note: "Next day if ordered before 2 p.m."
}
],
stores: [
{
id: "a",
name: "Downtown store",
distance: "0.7 mi",
hours: "Open until 7 p.m.",
stock: "3 on the shelf"
},
{
id: "b",
name: "Three Fountains Shopping Center store",
distance: "3.7 mi",
hours: "Open until 8 p.m.",
available: false,
restock: "October 14"
}
],
action: {
label: "Add to cart",
action: "add-to-cart"
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordswhat the buyer chooses ("How to receive it")
introstringWordsone sentence on the choice
productProductthe product: its price is the one the button states when the mode has none
modesMode[]Datathe purchase modes of the product, as the shop sells them
stores*Store[]Datathe pickup points and their stock, from the shop’s stores
reassurancestringWordsa real policy line ("Cancel anytime from your account")
action*Actionthe call to action: its words and the page action it runs
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Product product · 4 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
price*numberan amount in cents
currencystringDesignISO 4217, EUR by default
Mode modes[] · 5 props
PropTypeDescription
id*stringthe mode’s id
label*stringthe mode ("One-time purchase", "Every 4 weeks", "Home delivery")
pricenumberthe price in this mode, in cents
periodstringwhat the price covers ("/ 4 weeks")
notestringone line on the mode ("Cancel anytime"), the merchant’s own
Store stores[] · 7 props
PropTypeDescription
id*stringthe store’s id
name*stringthe store’s name
distancestringhow far the store is, e.g. "1.2 km"
hoursstringits opening hours, as the shop writes them
stockstringthe stock as the store reports it ("3 in stock")
availablebooleanfalse: not available
restockstringwhen it is back, when the store gave a date
Action action · 3 props
PropTypeDescription
label*stringWordswhat the button says before the amount ("Subscribe", "Add the bundle to the cart")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens; the chosen mode or store id is added
Options options · 1 props
PropTypeDescription
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
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: action
  • Reads products, stores from your app

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

  • Finder results cards: Recommended product cards with reasons, restart and see-all actions conclude a quiz; the merchant’s own rules only, with micro motion only.
  • Fit by size tabs: a size at a time: a row of size chips, and under it that size’s measurements and the models who wear it, to picture it before choosing.
  • Fit models cards: clothes worn by real people: height, measurements and the size each one wears, to compare with oneself.
  • Floating products staggered: two staggered columns of tall cards whose pictures drift at opposite paces as the page scrolls: an editorial run of 4 to 12 products; the merchant’s own products and figures only.
  • Fulfilment estimator card: a bordered card listing every shipping option with its delay and price: a cart or a product with several carriers.
  • Fulfilment estimator inline: a compact line under the price: a postcode field and the cheapest answer, for a product page that must stay short.
  • Garment cuts columns: a range with several cuts (slim, regular, relaxed): the ease of each, side by side.
  • Gift amount guide amounts: the merchant wants to say what each amount buys: one column per amount, drawn from the real catalogue.

All 409 storefront blocks