shadcn.io is not affiliated with official shadcn/ui
Verified Purchases Reviews Block for React
Reviews of a leather satchel with the purchase evidence beside each one: variant, how long it was owned, a masked order line and a hover card saying what was checked, ordered newest or longest owned.
Installation
Overview
Reviews with proof of purchase for React with Base UI, for the Wainscotbridge Satchel, a fictional leather satchel. A header states how many of the six typed reviews match an order, then a ruled band opens with a count and a ToggleGroup that orders the list, "Newest" or "Longest owned". Each row has three parts: the reviewer (initials, name, a "Verified purchase" button, the date), the stars with the title and text, and a list of purchase facts: the variant, how long it was owned and the order line with its middle digits masked. The ownership time ("Owned 3 weeks", "4 days", "5 months") is worked out from two typed dates, the delivery and the review, never typed. "Verified purchase" opens a hover card that lists what was checked (the order on file, the delivery date, the days between delivery and review). One review is a guest: it says "Guest review, no order on file" and its Owned figure reads "Not stated". Nothing is coloured by sentiment or by verification. It's built from Rating, Avatar, Hover Card, Toggle Group and Guides, with CSS transitions only.
FAQ
How do I use my own reviews?
Replace REVIEWS at the top of the file. Each review has an id, name, rating from 1 to 5, an ISO date, a title and a body, plus the purchase facts: variant, delivered (an ISO date), a masked order and verified. A guest review leaves delivered and order empty and sets verified to false. The ownership time, the "N of 6 match an order" line and both sort orders are worked out from those fields, so there are no totals to keep in step.
What does Verified purchase mean here?
In this demo it means the review has an order on file in the typed data: an order line, a delivery date and a review written after delivery. The hover card lists exactly those three things, filled in from the review's own fields. Nothing is looked up. On your site, wire the same fields to your order system and keep the wording to what that system really checks.
How is the ownership time worked out?
By whole days between the delivery date and the review date, using UTC date arithmetic so the same text appears on every server and in every time zone. Under 14 days it reads in days, under 60 in weeks (to the nearest), and beyond that in months. A guest review has no delivery date, so its Owned figure says "Not stated" and "Longest owned" places it last.
How does ordering work?
Press Newest or Longest owned. The list re-orders when you press, never under the pointer, and a polite note reads out the new order. Newest sorts the ISO dates; Longest owned sorts by days owned and breaks ties by date.
Related
- Pro
Verified Toggle Reviews
Score summariesA review summary with a Verified purchases only switch: the average, the count, the share rated four or more and five distribution rows are worked out again, with a delta line against all reviews.
- Pro
Trust Signals Reviews
ModerationHow an eyewear shop checks its reviews: four tallies counted from a typed review log and an accordion of five rules, each saying exactly what its count measures, with no trust score.
- Pro
Detailed Card Reviews
Cards and wallsOne review with everything it can carry in a card in card: the reviewer and purchase facts, five criteria scores, pros and cons, three drawn pictures, a Helpful vote and the seller's reply.
- Pro
Verified Buyer Testimonials
Ratings and reviewsOne focal review under a Verified purchase badge in a raised card inside a tinted shell, a divider and a receipt of what the customer bought, then a band of three compact reviews with the same badge.
- Pro
Helpful Votes Reviews
Votes and repliesThe best favourable and the best critical review of a water filter jug side by side, each with a Helpful vote and a worked-out 'n of m found this helpful', above the other reviews in ruled rows with a most-helpful or newest order.
- Pro
Compact List Reviews
Lists and pagesTwelve one-line reviews of a notes app as a real table with sortable column heads, a Select that mirrors the sort, and nothing to open.