Choice guide size cards — Storefront block
Prostorefront-choice-guide-size-cards · for product, catalog, home pages
Choice guide size cards
One card per size or variant with its picture, dimensions and what it holds: choosing a size
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-choice-guide-size-cardsUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontChoiceGuideSizeCards from '@/components/trame/blocks/storefront/storefront-choice-guide-size-cards.vue'
const props = {
title: "Which bag should you choose?",
intro: "Three questions we hear often, and what we answer at the workshop.",
rules: [
{
when: "You’re heading off for a weekend",
pick: "The 20-liter bag",
because: "It fits under an airplane seat and is comfortable to carry all day.",
media: "https://images.unsplash.com/photo-1680039211156-66c721b87625?w=1600&q=80",
alt: "A black flap backpack on a yellow background",
action: "product",
record: {
id: "sac-20"
}
},
{
when: "You’re traveling for a week or more",
pick: "The 35-liter bag",
because: "A dedicated shoe pocket and a ventilated back for long days.",
media: "https://images.unsplash.com/photo-1602845860431-35374f24f48d?w=1600&q=80",
alt: "A mustard canvas backpack with leather straps, resting in the grass",
action: "product",
record: {
id: "sac-35"
}
}
],
help: {
text: "Still unsure? Tell us what you carry and we’ll get back to you within two business days.",
link: {
label: "Write to the workshop",
action: "page",
record: {
id: "contact"
}
}
}
}
</script>
<template>
<StorefrontChoiceGuideSizeCards v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe section’s title, an h2 |
| intro | string | Wordsone or two sentences under the title |
| rules* | Rule[] | the rules that point to a choice |
| help | Help | a line and a link for the undecided |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Rule rules[] · 7 props
| Prop | Type | Description |
|---|---|---|
| when* | string | Wordsthe situation, in the visitor’s words ("You are going away for a weekend"); in size-cards, the dimensions ("30 × 20 × 12 cm") |
| pick* | string | Wordsthe recommended option ("The 20-litre bag"); in size-cards, the size’s name |
| because | string | Wordsone line on why, or in size-cards what it holds ("Contains: a 14-inch laptop") |
| media | string | Picturethe recommended product’s picture, the merchant’s own |
| alt | string | Wordswhat the picture shows |
| action | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens (the product), if any |
Help help · 2 props
| Prop | Type | Description |
|---|---|---|
| text* | string | Wordsthe line for the undecided ("Still not sure?") |
| link | Link | the link: its words and the page action it runs |
Link help.link · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat happens ("Write to us") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens, if any |
Options options · 1 props
| Prop | Type | Description |
|---|---|---|
| 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 |
| asset | a picture’s address as your app serves it |
| Link | your router’s link component |
| 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:
rules[],help.link
A storefront section, for product, catalog, home pages; it uses @lucide/vue, clsx, motion, tailwind-merge.
More storefront blocks
- 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.
- Checkout one page: a short cart: contact, delivery and payment stacked in one form beside a sticky summary.
- Checkout returning: a signed-in customer with a saved address and card: one card of rows, each editable alone, then one pay button.
- Checkout stepped: a long form or a phone: three steps, finished ones folded to a one-line recap with "Edit".
- Clothing rail: the pieces hang sideways on one drawn rail and turn to face the visitor on hover or focus, their neighbours swinging aside; a phone shows one piece at a time: a fashion shop’s new pieces or a short edit, 3 to 12 of the merchant’s own products, best with cut-out pictures of each piece on its own hanger (hanger "none"); a plain photo shot on white melts into a light page. No frame round the pictures.
- Collection banner split: the words on one half and the picture filling the other to the screen’s edge, the sub-categories as a ruled index with their counts: a collection with a tall picture and several sub-categories to jump to.
- Collection banner: a wide picture with the title card overlapping its edge: a collection with a strong picture or a campaign.
- Collection doors two doors: two collections side by side with one rule they share (new and classics, new and second-hand).