Review form page — Storefront block
Prostorefront-review-form-page · for product, account, review pages
Review form page
The product large on one side and the form beside it: the page a post-purchase email leads to
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-review-form-pageUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontReviewFormPage from '@/components/trame/blocks/storefront/storefront-review-form-page.vue'
const props = {
product: {
id: "p1",
name: "Trail Path running shoe",
brand: "Ridgeline",
variant: "Midnight blue · 9",
image: "https://images.unsplash.com/photo-1575987116913-e96e7d490b8a?w=1600&q=80",
alt: "Tan leather hiking boots on a rock"
},
action: "review.submit",
title: "Review your purchase",
intro: "A few honest lines help the next hiker choose the right pair.",
criteria: [
{
key: "fit",
label: "Fit",
low: "Runs small",
high: "Runs large"
},
{
key: "comfort",
label: "Comfort"
}
],
policy: "Every review is read by our team before it appears. We publish good and bad reviews alike, and never edit your words.",
terms: {
label: "Review guidelines",
action: "page.reviewTerms"
},
options: {
photos: 4,
recommend: true
}
}
</script>
<template>
<StorefrontReviewFormPage v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| product* | Product | Datathe product being reviewed: the one the customer bought |
| action* | string | Actionthe mutation that receives the review; the form is hidden when the page lacks it |
| title | string | Wordsthe heading ("Review your purchase") |
| intro | string | Wordsone line under the heading, e.g. "Your words help the next customer choose" |
| criteria | Criteria[] | aspects rated apart, each 1 to 5 stars, each optional to answer |
| reviewer | string | Wordsthe name the review is signed with when the customer is known (signed in, or from the post-purchase email); absent: the form asks a first name and an email |
| policy | string | Wordshow the shop checks reviews before they appear, in its own words, e.g. "Every review is read before it is published" |
| terms | Terms | the full review terms |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Product product · 6 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe product’s name |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| alt | string | Wordswhat the main picture shows |
| brand | string | Wordsthe brand or maker |
| variant | string | Wordsthe options the customer bought, written out ("Navy · 42") |
Criteria criteria[] · 4 props
| Prop | Type | Description |
|---|---|---|
| key* | string | Designthe criterion’s key, posted with its stars, e.g. "fit" |
| label* | string | Wordswhat is rated, e.g. "Fit" |
| low | string | Wordswhat one star means, e.g. "Runs small" |
| high | string | Wordswhat five stars mean, e.g. "Runs large" |
Terms terms · 4 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "See the collection" |
| action | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
| url | string | Designan address outside the app |
Options options · 3 props
| Prop | Type | Description |
|---|---|---|
| photos | number | let the customer attach up to this many photos; absent: no photo field |
| recommend | boolean | true: ask whether they would recommend it, with no answer chosen in advance |
| 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:
review.submit,terms - Reads
productsfrom your app
A storefront section, for product, account, review 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
- Restock notify inline row: a product page or a sold-out list: one compact row per sold-out variant with its own field and bell button.
- Retired products rows: products no longer made with their years, quantity and reason: an honest page about what was stopped.
- Return request stepped: the request on one page in three numbered steps (items, reason, way back), a summary beside it.
- Returning order review bag first: a signed-in customer: the bag first, saved address and card as rows, and who is signed in at the top.
- Review list photo first: reviews with customer photos shown as a grid first, then the rest: photo-heavy products where the pictures matter.
- Review list two column: the summary sticky on the left, reviews scrolling on the right: a wide screen where the summary stays visible.
- Review list: a single-column list of reviews with a summary header: the standard review page.
- Review panel rail: the rating, the photo strip and the filter chips gathered in a narrow rail beside compact review rows: a panel that sits next to the gallery, or floats as a dialog.