Advice questions — Storefront block
Prostorefront-advice-questions · for product, catalog, home pages
Advice questions
3 or 4 yes/no questions, each opening its advice (details, no script): a short questionnaire in the page
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-advice-questionsUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontAdviceQuestions from '@/components/trame/blocks/storefront/storefront-advice-questions.vue'
const props = {
title: "Not sure which appointment to book?",
intro: "Three questions we ask at the front desk of Willow Street Physio, and what we usually suggest.",
questions: [
{
q: "Has the pain lasted more than two weeks?",
yes: "Book a first assessment: an hour to find the cause, not just the sore spot.",
no: "Rest, ice and gentle movement first. Call us if it is still there next week."
},
{
q: "Did it start with a fall, a twist or a knock?",
yes: "Ask for a sports injury slot: we check the joint before any exercise.",
no: "A standard assessment fits: posture, load and habits are the usual suspects."
}
],
help: {
text: "Still unsure? Describe what hurts and a physiotherapist will call you back within one business day.",
link: {
label: "Ask the clinic",
action: "page",
record: {
id: "contact"
}
}
}
}
</script>
<template>
<StorefrontAdviceQuestions 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 |
| questions* | Question[] | the questions shown, in order |
| 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 |
Question questions[] · 3 props
| Prop | Type | Description |
|---|---|---|
| q* | string | Wordsa yes/no question ("Mostly worn in town?") |
| yes* | string | Wordsthe advice if yes |
| no* | string | Wordsthe advice if no |
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 |
| 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:
help.link
A storefront section, for product, catalog, home pages; it uses @lucide/vue, clsx, motion, tailwind-merge.
More storefront blocks
- Addon picker main and addons: a big main card with checkboxes for the add-ons beside it and the summary under: add-ons that complete one product.
- Address check side by side: Compare the entered address with a postal service suggestion at equal prominence.
- Address check stacked: Stack the two addresses in a narrow checkout column, keeping both choices available.
- Adjusted cart with adjustment: when something besides the lines moves the price (a trade-in credit, import duties): a card explains it in numbered steps above the summary.
- Ageing stages row: how a choice ages, in four moments from the first week to the fifth year: a break-in or durability story.
- Alone or bundle versus: two columns, the product alone and the whole bundle, the bundle larger: a set sold at a real saving.
- Archive figures numbers: Supplied figures and a period chart above the archive entries; the merchant's own measures only.
- Archive shelf cards status: Material cards with a specification and a status beside the picture; the merchant's own archive only.