Rating criteria bars — Storefront block

Pro

storefront-rating-criteria-bars · for product, home, catalog pages

Rating criteria bars

A product rated by several criteria: the overall note and one labelled bar per criterion; the merchant’s own only

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-rating-criteria-bars

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontRatingCriteriaBars from '@/components/trame/blocks/storefront/storefront-rating-criteria-bars.vue'

const props = {
heading: "What our customers say",
summary: {
count: 12,
average: 4,
distribution: [
{
rating: 5,
count: 6
},
{
rating: 4,
count: 3
}
]
},
reviews: [
{
id: "r1",
author: "Camille",
rating: 5,
title: "Exactly what I was hoping for",
text: "The canvas is thick, the stitching is clean and the color matches the photos. I’ve used it every day for a month.",
date: "September 12, 2026",
verified: true,
helpful: 14,
product: "Canvas tote bag",
images: [
"https://images.unsplash.com/photo-1617500603321-bcd6286973b7?w=1600&q=80"
]
},
{
id: "r2",
author: "Julien",
rating: 4,
title: "Very good, a bit pricey",
text: "Great quality, fast delivery. I’m taking off one star because the price seemed high for the size.",
date: "September 3, 2026",
verified: true,
helpful: 6,
product: "Canvas tote bag"
}
],
all: {
label: "See all reviews",
action: "reviews"
},
write: {
label: "Write a review",
action: "review-form"
},
attributes: [
{
label: "Build quality",
score: 4.7,
quote: "Clean stitching, thick canvas."
},
{
label: "Matches the photos",
score: 3.9,
quote: "Some customers find the green darker in person."
}
],
options: {
perPage: 6,
note: "Reviews are published as received, after we check that they are about our products. We don’t remove negative reviews."
}
}
</script>

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

Props

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

PropTypeDescription
heading*stringWordsthe section’s title ("Customer reviews")
summarySummaryDatacomputed by the shop from all its stored reviews, never typed: when absent, the block counts the reviews it is given
reviews*Review[]Datathe reviews to show, as stored (a page of them is fine)
attributes*Attribute[]Datathe product rated by criterion ("Size", "Quality"), from the shop’s own collected ratings
allAllthe see-all link: its words and the page action it runs
writeWritethe write action: its words and the page action it runs
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Summary summary · 3 props
PropTypeDescription
averagenumberthe average rating, 1 to 5
count*numberhow many, as the host counted them
distributionDistribution[]how many reviews give each star level
Distribution summary.distribution[] · 2 props
PropTypeDescription
rating*numberthe star level, 1 to 5
count*numberhow many, as the host counted them
Review reviews[] · 11 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
author*stringWordswho wrote the review, as the shop shows it
rating*numberthe stars given, 1 to 5
titlestringWordsthe review’s title
text*stringWordsthe review, in the customer’s words
datestringWordswhen it was written, as the shop writes it
verifiedbooleanbought in the shop, as the shop recorded it
imagesstring[]Picturea picture: a root-relative path (/media/…) or an absolute URL
replystringWordsthe merchant’s reply
helpfulnumberhow many visitors found it helpful, as the shop recorded it
productstringWordsthe product it is about, when the block is not on that product’s page
Attribute attributes[] · 3 props
PropTypeDescription
label*stringWordsthe attribute’s name, as shown
score*numberthe attribute’s average score, 0 to 5
quotestringWordsa reviewer’s words on this attribute
All all · 3 props
PropTypeDescription
label*stringWordswhat the link says ("See the 312 reviews")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens (a product), if any
Write write · 3 props
PropTypeDescription
label*stringWordswhat the link says ("See the 312 reviews")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens (a product), if any
Options options · 4 props
PropTypeDescription
showVerifiedbooleanshow "Verified purchase" where the shop recorded it (on by default)
perPagenumberhow many reviews show before "See more" (6 by default)
notestringWordshow reviews are collected and moderated, as the merchant states it: never claimed by default
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
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
  • Subtle motion: one short reveal; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: all, write
  • Reads reviews from your app

A storefront section, for product, home, catalog 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

  • Protection choice rows: three choices in radio rows, each saying what it adds, with the total: a protection or a service offered with a product.
  • Quick estimate estimator: a quick estimate from the merchant’s own grid: a few choices, one large figure, the rule it uses written beside it.
  • Quick order table: a trade buyer who knows what they want: every reference in a table, a quantity per line, the total running.
  • Rate table: a grid of the merchant’s own rates (shipping by zone, repair pricing): rows against columns, stacked cards on a phone.
  • Rating link inline: a buy box that is already full: just the stars and the count beside the title, linking to the reviews.
  • Recent purchases card and counts: the corner card above a thin strip of the figures the shop measures (people viewing, sold today); on a phone the strip alone, the card on tap: a busy product page with real live figures; counts only when measured, orders real and never looped.
  • Recent purchases corner card: a small card in a bottom corner, thumbnail, "Camille in Lyon ordered …" and the time, stepped by the visitor only: discreet proof on a home or product page; the merchant’s real orders only, anonymised, never advancing on its own nor looped.
  • Recent purchases pill: a compact pill with the buyer’s initial, one line and the measured figures beside it: a quiet product page where a card would be too much; the merchant’s real orders only, never looped.

All 409 storefront blocks