StealThis .dev

Shop — Reviews + Rating Breakdown

A credible storefront reviews block pairing an average-rating summary with a clickable 5-star distribution breakdown, star and recency filters, four sort modes, and individual review cards carrying avatars, verified badges, dates, and helpful votes. A star-input form lets shoppers publish a new review that updates the average, the bars, and the list in real time, with load-more paging and accessible keyboard controls throughout for trustworthy social proof.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Reviews + Rating Breakdown

A self-contained product-reviews module built for social proof. The summary panel shows the average score with half-star rendering, a recommend rate, and a five-row distribution where each bar is a button — click a row to filter the list to that rating, click again to clear. Filter pills and a sort menu (most recent, most helpful, highest, lowest) keep the result set in sync, with a live count and load-more paging underneath.

Each review card carries a colored avatar with initials, a verified-purchase badge, a relative date, a star row, and a helpful-vote button that toggles its count and updates the “found this helpful” note. The write-a-review form uses an accessible star-rating input (hover preview, arrow-key navigation, ARIA radiogroup) and validates name, body, and rating before publishing. Submitting prepends the new review and recomputes the average, breakdown bars, and recommend rate instantly.

Everything is vanilla JS with no dependencies: state lives in a small object, rendering is data-driven, and interactions are wired through event delegation. The layout collapses from a two-column summary to a single stacked column under 680px and stays usable down to 360px, with focus-visible rings and reduced-motion support.

Illustrative storefront UI only — fictional products, prices, and reviews. No real checkout.