Review snapshot distribution — Storefront block
Prostorefront-review-snapshot-distribution · for product pages
Review snapshot distribution
A product page that wants the average and the five star bars at a glance, with a link to every review
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-snapshot-distributionUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontReviewSnapshotDistribution from '@/components/trame/blocks/storefront/storefront-review-snapshot-distribution.vue'
const props = {
title: "Customer reviews",
average: 4.6,
count: 128,
distribution: [
{
rating: 5,
count: 94
},
{
rating: 4,
count: 21
}
],
scales: [
{
label: "Size",
position: 0.42,
lowLabel: "Runs small",
highLabel: "Runs large",
note: "Most customers stick with their usual size."
},
{
label: "Comfort",
position: 0.8,
lowLabel: "Firm",
highLabel: "Very soft"
}
],
quote: {
id: 1,
author: "Camille R.",
rating: 5,
title: "Perfect from the very first hike",
text: "No blisters after twelve miles, the support is excellent and the sole grips well in the wet.",
date: "September 12, 2026",
verified: true
},
action: {
label: "Read all 128 reviews",
action: "reviews"
},
note: "Reviews are left by customers after their order arrives and checked before they’re published. We publish positive and negative reviews alike; no review is paid for."
}
</script>
<template>
<StorefrontReviewSnapshotDistribution v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe block’s title ("Customer reviews") |
| product | Product | Datathe product: its stored rating and review count stand in when `average` and `count` are absent |
| average | number | Datathe average of all the shop’s stored reviews, never typed by hand |
| count | number | Datahow many reviews the shop stores for this product; 0 hides the block |
| distribution | Distribution[] | Datahow many reviews per star, from the shop’s review store |
| scales | Scale[] | Datafit, comfort or width as collected from reviewers: real aggregates only |
| quote | Quote | Dataone real review the merchant chose to show |
| action | Action | the call to action: its words and the page action it runs |
| note | string | Wordshow the reviews are collected and checked, in the shop’s own words |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Product product · 4 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe product’s name |
| rating | number | the average of the shop’s own stored reviews |
| reviewCount | number | how many stored reviews the rating averages |
Distribution distribution[] · 2 props
| Prop | Type | Description |
|---|---|---|
| rating* | number | the star level, 1 to 5 |
| count* | number | how many, as the host counted them |
Scale scales[] · 5 props
| Prop | Type | Description |
|---|---|---|
| label* | string | what is rated ("Size", "Comfort") |
| position* | number | the average answer of reviewers, 0 (low) to 1 (high) |
| lowLabel* | string | the low end ("Small") |
| highLabel* | string | the high end ("Large") |
| note | string | a short note under the scale |
Quote quote · 9 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| author* | string | Wordswho wrote the review, as the shop shows it |
| rating* | number | the stars given, 1 to 5 |
| title | string | Wordsthe review’s title |
| text* | string | Wordsthe review, in the customer’s words |
| date | string | Wordswhen it was written, as the shop writes it |
| verified | boolean | bought in the shop, as the shop recorded it |
| images | string[] | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| reply | string | Wordsthe merchant’s reply |
Action action · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat the link says ("Read the 128 reviews") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens, if any |
Options options · 2 props
| Prop | Type | Description |
|---|---|---|
| showVerified | boolean | show "Verified purchase" on the quote when the shop recorded it (on by default) |
| 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:
action - Reads
reviewsfrom your app
A storefront section, for product pages; it uses @lucide/vue, 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
- 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.
- Review panel wall: the score, its bars and the customer photos in one wide band, the filters and sorts in a toolbar, then the reviews as cards in balanced columns: a full-width reviews section under the product, with many reviews to browse; the customers’ own reviews only.
- Review signal pill: a small pill above a heading carrying the rating and the count: a signal that introduces a title; the merchant’s own only.
- Reviews summary bars: a product page: the average, the count and one bar per star beside the list of reviews; the merchant’s own only.
- Reviews summary cards grid: a home or a landing: many short reviews as cards, each with its stars, author and product; the merchant’s own only.
- Reviews summary pair: a product page that wants to be believed: the most helpful positive review beside the most helpful critical one; the merchant’s own only.
- Reviews summary photo wall: reviews that come with customers’ photos: a wall of pictures, each opening its full review; the merchant’s own only.