Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Top Rated Testimonials Block for React

Four reviews of an operations app with a sort control in the header: most helpful, highest rated or newest, re-ordered live from typed numbers, in one band of ruled rows with a status line and an average.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Reviews that answer to the reader, for React with Base UI. A compact header ("Read the reviews in the order you need", with a bold lead about Backroom, a fictional operations app for small practices) carries a pill-shaped sort control at its end with three choices: most helpful, highest rated and newest. Under it, one band between the page's rails holds a summary line, which says how the list is sorted and gives the average rating computed from the reviews, and four review rows divided by hairlines. Each row pairs its metadata (foreground stars, how long ago, how many people found it helpful) with a titled review, and the review that tops the rating sort carries a "Top rated" badge wherever it lands. Rows fade in on each change, and nothing moves with reduced motion. It's built from Segment Group, Badge, Avatar and Guides, with Lucide icons, CSS transitions only and your theme's tokens; it has no button, so there's no primary colour in it. For product pages, marketplaces and docs sites where visitors want to scan reviews their own way.

FAQ

How do I use my own reviews?

Edit REVIEWS at the top of the file. Each review has its stars, a helpful count, an age in days for the "Newest" sort, and the same age as words in when. The three orders, the average and the "Top rated" badge are derived from those numbers, so nothing is ordered by hand.

How are ties broken?

"Highest rated" puts the most helpful review first among equal ratings, which is also how the "Top rated" badge is chosen. "Most helpful" and "Newest" sort on one number each.

How are the lines drawn?

Guides bleed marks="top" rules="top" on the page column draws the rails and the top rule. The band under the header has its own Guides marks="top" rules="top" sides={false}, and the rows start with a second one, so the summary line sits between two ruled lines with plus marks on the rails; the rows themselves are divided by divide-y. The block ends in its last row without a bottom rule: the next section draws its own top rule.

How does it work with a keyboard and a screen reader?

The sort control is a radio group named "Sort reviews by", with arrow keys between choices. After every change a polite status line reads out, for example "4 reviews, sorted by highest rated". Each review's stars are decorative and read as "Rated 5 out of 5". The stars are in foreground tones, with empty ones in the border colour.

Why are the times written as words?

"3 weeks ago" is typed data, not computed on render, so the server and the browser always agree and the block never shows a stale date. Replace them with your own labels or compute them in the server component that feeds the block.

What happens with reduced motion?

The rows swap order instantly without fading in.

How does it look on a phone?

The sort control sits under the header's sentence, the metadata stacks above each review instead of sitting beside it, and the summary line keeps the sort on the start side and the average on the end. At 320 pixels the three choices still fit on one line.

  • Pro

    Verified Buyer Testimonials

    Ratings and reviews

    One 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

    With Rating Testimonials

    Collect a review

    One large customer quote over a closing band you can rate in: choose stars and the average and the rating count change on the spot, with a note that nothing is saved.

  • Pro

    A review summary whose histogram rows are filter buttons: press a star row and the featured reviews narrow to that rating, with a live count and an empty state.

  • Pro

    Three long reviews of a bookkeeping app beside a rail of proof: the average rating and its spread, with Helpful and Not helpful votes whose counts change as you choose.

  • Pro

    A vertical column histogram of one-to-five star reviews in one framed figure whose cells share hairlines: the score and a plain-words verdict, one owner's quote, and the chart with the value above each column and a dashed average marker. A Shine Button in the header links to the reviews.

  • Pro

    Testimonial Inline Pricing

    Proof and guarantees

    Three ad-manager plans as compact rows, each pairing its price, button and first four features with a quote from a customer on that plan, set beside it at reading size.