Checkout narrow sheet — Storefront block

Free

storefront-checkout-narrow-sheet · for checkout pages

Checkout narrow sheet

A calm, focused checkout with a few items: one centred column at every width, a summary bar that opens the lines, contact, delivery and payment stacked, one pay 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-checkout-narrow-sheet

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontCheckoutNarrowSheet from '@/components/trame/blocks/storefront/storefront-checkout-narrow-sheet.vue'

const props = {
title: "Complete your order",
intro: "Shipping to the contiguous US, Canada and Mexico.",
lines: [
{
id: 1,
product: {
id: 1,
name: "Lightweight rain jacket",
image: "https://images.unsplash.com/photo-1694561418303-16393986b86d?w=1600&q=80",
alt: "Lightweight rain jacket"
},
unitPrice: 12900,
quantity: 1,
variant: "Forest green · M"
},
{
id: 2,
product: {
id: 2,
name: "24 L backpack",
image: "https://images.unsplash.com/photo-1602845860431-35374f24f48d?w=1600&q=80",
alt: "24 L backpack"
},
unitPrice: 8900,
quantity: 1,
variant: "Sand"
}
],
totals: {
subtotal: 26200,
shipping: null,
tax: 4367,
taxIncluded: true,
total: 26200
},
countries: [
{
code: "US",
name: "United States"
},
{
code: "CA",
name: "Canada"
}
],
shippingOptions: [
{
id: "standard",
name: "Home delivery",
price: 490,
arrival: "Arrives October 14–16",
note: "Package tracking by email"
},
{
id: "express",
name: "Express 24h",
price: 1190,
arrival: "Arrives October 13"
}
],
actions: {
place: "place-order",
back: "cart",
signIn: "sign-in"
},
options: {
guest: true,
simulated: true,
newsletter: "Get new arrivals and offers by email",
payNote: "Your card is charged when your order ships."
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe page’s heading ("Complete the order")
introstringWordsone line under the heading, if the merchant has something to say (a delay, a contact)
lines*Line[]Datathe cart’s lines, as the server prices them
totals*TotalsDatathe cart’s totals from the server: shipping null until a way to ship is chosen
countriesCountry[]Datathe countries the shop delivers to; the first is the default
shippingOptionsShippingOption[]Datathe ways to ship, with price and arrival from the shipping tool
onlyShippingbooleanthe shop has one way to ship that serves this order (the first of shippingOptions): shown as a fact, nothing to choose
savedAddressSavedAddressDatathe signed-in customer’s address, for `returning`
savedMethodSavedMethodDatathe signed-in customer’s saved payment method (masked by the processor), for `returning`
customerstringWordswho is signed in ("Camille Martin · [email protected]"), for `returning`
actionsActionsthe page actions the block runs, each described below
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Line lines[] · 8 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
product*Productthe product on the line
variantstringWordsthe chosen options, written out ("Navy · 42")
unitPrice*numberan amount in cents
compareAtnumberan amount in cents
quantity*numberhow many, at least 1
maxQuantitynumberthe most the line may hold
notestringWordsa line note: a gift, a delivery delay
Product lines[].product · 4 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
imagestring | nullPicturethe main picture; null or absent: the product has none yet
altstringWordswhat the main picture shows
Totals totals · 11 props
PropTypeDescription
subtotal*numberan amount in cents
discountnumberan amount in cents
discountLabelstringWordswhat the discount is, e.g. a code’s name
shippingnumber | nullnull: computed at the next step
shippingLabelstringWordsthe delivery method, e.g. "Standard delivery"
feesnumberfees the shop charges on top (service, handling), when it does
feesLabelstringWordswhat the fees are ("Service fee")
taxnumberan amount in cents
taxIncludedbooleantrue: the prices include tax
total*numberan amount in cents
currencystringDesignISO 4217, EUR by default
Country countries[] · 2 props
PropTypeDescription
code*stringthe country’s ISO code, e.g. "FR"
name*stringthe country’s name
ShippingOption shippingOptions[] · 5 props
PropTypeDescription
id*stringthe shipping option’s id
name*stringthe shipping option’s name
price*numberits price in cents; 0 when free
arrivalstringwhen it arrives, as the shop writes it
notestringa short note on this delivery option
SavedAddress savedAddress · 7 props
PropTypeDescription
name*stringWordsthe recipient’s name
line1*stringWordsstreet and number
line2stringWordsa second address line: building, floor
postalCode*stringWordsthe postcode
city*stringWordsthe town
country*stringWordsthe country
phonestringWordsa phone number for the delivery
SavedMethod savedMethod · 2 props
PropTypeDescription
label*stringthe saved method’s name, as shown
detailstringa precision on it, e.g. "expires 08/27"
Actions actions · 5 props
PropTypeDescription
placestringActionplaces the order with the form’s values; without act the form posts them to its address
quotestringActionre-prices the cart when the country or the way to ship changes, through a host that runs actions; posts country and shipping
donestringActionwhere a placed order leads (its confirmation), with the data the place action answered
backstringActionthe cart page
signInstringActionthe sign-in page
Options options · 6 props
PropTypeDescription
guestbooleansay that an account is not needed
shippingbooleansomething ships: false hides the address (digital goods); true by default
simulatedbooleanpayments are a demo: say it plainly
newsletterstringWordsthe label of an opt-in checkbox (unchecked); no label, no checkbox
payNotestringWordsone sentence of the merchant’s real payment policy, beside the pay button ("Your card is charged at shipping.")
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 }
gonavigates after a success
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
cart.feesFeesFrais
cart.shippingShippingLivraison
cart.subtotalSubtotalSous-total
cart.totalTotalTotal
checkout.address1AddressAdresse
checkout.address2Apartment, suite, etc.Complément d’adresse
checkout.backToCartBack to cartRetour au panier
checkout.bagBagPanier
checkout.cardCardCarte bancaire
checkout.checkFieldCheck this field.Vérifiez ce champ.
checkout.chooseShippingChoose a shipping method.Choisissez un mode de livraison.
checkout.cityCityVille
checkout.contactContactContact
checkout.continueContinueContinuer
checkout.continueToContinue to {step}Continuer vers {step}
checkout.countryCountryPays
checkout.deliveryDeliveryLivraison
checkout.discountDiscountRéduction
checkout.editEditModifier
checkout.emptyYour cart is empty.Votre panier est vide.
checkout.expressWithPay with {method}Payer avec {method}
checkout.freeFreeGratuite
checkout.fullNameFull nameNom complet
checkout.guestYou do not need an account to order.Pas besoin de compte pour commander.
checkout.invalidEmailEnter a valid email address.Saisissez une adresse e-mail valide.
checkout.item1 item1 article
checkout.items{count} items{count} articles
checkout.noteSentTo {place}Vers {place}
checkout.notYetCalculated at the next stepCalculée à l’étape suivante
checkout.orCardor pay by cardou payer par carte
checkout.payPay {amount}Payer {amount}
checkout.paymentPaymentPaiement
checkout.phonePhoneTéléphone
checkout.postalCodePostal codeCode postal
checkout.quantityQuantityQuantité
checkout.requiredThis field is required.Ce champ est obligatoire.
checkout.saveSaveEnregistrer
checkout.shippingMethodShipping methodMode de livraison
checkout.signedInAsSigned in: {who}Connecté : {who}
checkout.signInAlready a customer? Sign inDéjà client ? Se connecter
checkout.simulatedDemo payment: no card is charged.Paiement de démonstration : aucune carte n’est débitée.
checkout.stepOfStep {n} of {total}Étape {n} sur {total}
checkout.summaryOrder summaryRécapitulatif
checkout.taxTaxTVA
checkout.taxInclincl. taxdont TVA
checkout.totalToPayTotal to payTotal à payer
form.emailEmail addressAdresse e-mail
form.optionaloptionalfacultatif
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
  • No motion; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: checkout.place, checkout.quote, actions.done, actions.back, actions.signIn
  • Reads cart, shipping_options from your app

A storefront section, for checkout pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.

More storefront blocks

All 409 storefront blocks