Party details per person — Storefront block

Pro

storefront-party-details-per-person · for checkout pages

Party details per person

A card per guest, the one who books first with every field, the others with theirs, each added or removed in place beside the booking’s summary: a small party whose guests each need a few details

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-party-details-per-person

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontPartyDetailsPerPerson from '@/components/trame/blocks/storefront/storefront-party-details-per-person.vue'

const props = {
booking: {
id: "trip-bivouac-14jun",
name: "Two-day lake bivouac, guided",
image: "https://images.unsplash.com/photo-1576176539998-0237d1ac6a85?w=1600&q=80",
alt: "Two tents on a meadow facing a mountain lake",
when: "Saturday 14 June, 9:00",
duration: "2 days, 1 night",
place: "Lakeside car park, Glenridding",
unitPrice: 14500
},
party: {
size: 2,
max: 8
},
fields: [
{
key: "firstName",
label: "First name",
required: true,
autocomplete: "given-name"
},
{
key: "lastName",
label: "Last name",
required: true,
autocomplete: "family-name"
}
],
guests: [
{
firstName: "Camille",
lastName: "Renard",
email: "[email protected]"
}
],
action: "checkout.party",
back: {
label: "Back to dates",
action: "checkout.dates"
},
title: "Who is coming?",
note: "Names go on the hut booking and the meal order. We never share them.",
options: {
submitLabel: "Continue to payment"
}
}
</script>

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

Props

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

PropTypeDescription
booking*BookingDatathe booking this step is for, from the cart
party*Partythe party’s size and the merchant’s limits
fields*Field[]the details the merchant needs, in order: only what it really uses
guestsRecord<string, string>[]Datathe details already known or entered, one record per guest by field key, the person who books first
action*stringActionsaves the party: through the host it receives `{ size, guests }`; posted natively the form carries `size` and `g<n>.<key>` per guest. The form is hidden when the page lacks it
backBackthe step before, e.g. "Back to dates"
titlestringWordsthe step’s heading, e.g. "Who is coming?"
notestringWordswhy the merchant needs these details, in its own words, e.g. "Names go on the hut booking; we never share them"
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Booking booking · 8 props
PropTypeDescription
id*string | numberDatathe booked item’s id, posted with the details
name*stringWordswhat is booked, e.g. "Two-day lake bivouac, guided"
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows
whenstringWordsthe date and time booked, as the shop writes it, e.g. "Saturday 14 June, 9:00"
durationstringWordshow long it lasts, e.g. "2 days, 1 night"
placestringWordswhere it starts, e.g. "Lakeside car park, Glenridding"
unitPrice*numberthe price per person, in cents
Party party · 3 props
PropTypeDescription
size*numberhow many people are booked now
minnumberthe fewest people the merchant takes; 1 by default
max*numberthe most people one booking takes, as the merchant set it
Field fields[] · 8 props
PropTypeDescription
key*stringDesignthe field’s name, posted for each guest, e.g. "firstName"
label*stringWordswhat is asked, e.g. "First name"
type'text' | 'email' | 'tel' | 'date' | 'select'the kind of answer: text by default
requiredbooleantrue: the guest must answer it
choicesstring[]Wordsthe answers of a select field
ask'everyone' | 'lead'who it is asked of: everyone by default, or only the person who books (an email, a phone)
autocompletestringDesignthe browser’s autofill token for the person who books, e.g. "given-name" or "email"
helpstringWordsone short line under the field, e.g. "As written on the passport"
Back back · 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
Options options · 2 props
PropTypeDescription
submitLabelstringWordsthe button that moves on, e.g. "Continue to payment"
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
  • No motion; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: checkout.party, back
  • Reads bookings from your app

A storefront section, for checkout 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

All 409 storefront blocks