shadcn.io is not affiliated with official shadcn/ui
Centered Star Rating Hero Block for React
A showcase centered hero led by its review score, with five stars and the average, a Shine Button, review-site badges and three reviews below in cells whose hairlines overshoot their corners.
Installation
Overview
A showcase centered hero that opens with its review score, for React with Base UI. Five stars filled to the average sit beside the score and the number of reviews behind it, then a headline, a sentence, a Shine Button with an outline one, and a row of review-site badges. Below them three reviews stand in separate cells between solid page rails, each cell's hairlines running a little past its corners with a + mark on the top-start one. The stars are foreground colored, never amber. It's built from Shine Button, Button, Badge and Guides, with Lucide stars and Tailwind CSS, and the copy is for Slatewise, a fictional scheduling app. Each part fades in once with CSS, and nothing moves for visitors who ask for reduced motion. For SaaS landing pages, app products and any page where a high score from many reviewers is the strongest reason to sign up.
FAQ
How do I change the score, the review count and the badges?
Edit the constants at the top of the file. RATING.score is the average out of 5 and also fills the stars; RATING.reviews is the count as it should read, a string, so the server and the browser render the same digits whatever their locale. Each entry in PLATFORMS is one badge: the review site's name, its award and its score there. REVIEWS holds the three quotes, each with its author and role. Use the scores and the words your customers actually gave you.
How do the stars show a score like 4.9?
Each star is two Lucide stars on top of each other: a faint one, and a filled one in a box clipped to a width that fillOf works out from the score. At 4.9 the first four are full and the fifth is filled to 90%, so the row shows the real average, not a rounded five. The box starts at the inline start, so on a right-to-left page the stars fill from the right.
How do screen readers read the rating?
As "Rated 4.9 out of 5", then "Based on 3,241 verified reviews". The stars are drawings, hidden from assistive technology, and visually hidden words around the visible score say what it means; each review's stars say "Rated 5 out of 5". The badges are a list, each read as its name with ", rated 4.8" after it, and each review is a figure with its quote in a blockquote and its author in a figcaption. The score is shown, not asked for, so it isn't a control; to let visitors give a rating, use the Rating component.
How do I show live numbers from a review site?
Fetch the average and the count where your page loads its data, on the server when you can, round the score to one decimal and pass both in place of RATING. The stars follow any score from 0 to 5. Format the count once, on the server, so it doesn't change after the page loads, and refresh it on a schedule rather than on every visit: review totals move slowly.
How does this rating hero adapt to small screens?
The stars and score stay on one line above the headline, which wraps, balanced, at text-4xl. The three badges wrap onto centered rows, the calls to action sit side by side while they fit, and the three reviews stack below as cells of the same width, so the button is on the first screen and the reviews follow it.
When should I use a rating hero instead of a testimonial hero?
Use this hero when the volume is the point: a high average from thousands of reviews, on sites your buyers already check. Use a testimonial hero when one quote from someone your visitors know does more than any number, and pair the two further down the page if you have both.
Related
- “Pro
Featured Testimonial Hero
TestimonialsA compact start-aligned hero with a headline, a Shine Button and an outline action over a closing band that holds one customer's quote, large, beside their rating, name, role and the number it is about.
- Pro
Centered Award Badge Hero
Logos and social proofA compact centered hero led by an award plaque in a hairline frame, with a headline, a Shine Button and an outline button, then one band of three more recognitions.
- Pro
Left-Aligned Social Proof Bar Hero
Logos and social proofA compact start-aligned hero closed by a three-cell social proof bar on its own rule: an avatar stack with the user count, a five-star rating with the review count and a compliance mark.
- Pro
Centered Trusted By Logo Row Hero
Logos and social proofA compact centered hero built as bands: an announcement pill, a headline, two calls to action and three trust points, then a ruled label and a row of six customer wordmarks in divided cells.
- Pro
Avatar Stack Side Rail Hero
Logos and social proofA compact hero for a community: a headline, a Shine Button and a second action beside a side rail of proof: a stack of member avatars over a line of social proof, then three stats in ruled rows.
- “Pro
Testimonials Rotating Hero
TestimonialsA reverse split hero with a card that shows one customer quote at a time in a hairline frame, a pause button and a dot per quote, beside an announcement pill, a headline, a Shine Button and an outline action.