Skip to content

Components / Sections

Rating Summary

What people who use the app say, as the stores show it: the average large with its stars and how many rated, a bar for each star count with its share written beside it, and a few reviews, each with its stars, its title, who wrote it, when and where. The bars grow in turn as the summary arrives. The stars are one element each (a star mask repeated five times, filled to the value), named by their value for a screen reader. Zero JavaScript.

Live demo

Ratings

What people say

Sample figures and reviews, made up for this demo.

4.8 out of 5

12,400 ratings on the App Store and Google Play

  • 5 stars: 86%
  • 4 stars: 9%
  • 3 stars: 3%
  • 2 stars: 1%
  • 1 star: 1%
  • Finally stuck

    Forty days of reading in a row, which has never happened to me before.

    Mara L.September 2026 · App Store
  • The rest day is the reason I did not quit in week two.

    Jonas W.August 2026 · Google Play
  • Calm and simple

    Exactly as much as I need. I would like a darker widget.

    Tomás R.August 2026 · App Store
  • My sister and I share a streak. Neither of us wants to break it.

    Priya S.July 2026 · Google Play

Live, from the library itself, at full size: scroll, hover, navigate away and back. The demo is never gated.

Variants · each row writes the attribute the prop writes; the section's own CSS answers

tone
density

Measured

JavaScript of its own

0 B

Uses Reveal and the shared runtime (1.9 kB raw, once per site). With those included: 3.0 kB raw.

CSS 11.2 kB raw including the base tokens. Measured from a production build, and again in CI for every change that can move it.

Browser support

Baseline · widely available

Chrome 120 · Firefox 53 · Safari 15.4; needs mask-image. Elsewhere: without masks the stars are a filled bar; the numbers carry the rating.

Install Pro

The demo above is never gated; the source is. With a key in components.json (see account), the registry serves it like any other item:

terminal
npx shadcn@latest add @moonarc-pro/rating-summary
src/pages/index.astro
---
import RatingSummary from '@/components/moonarc/pro/RatingSummary.astro';
---
<RatingSummary
  headline="What people say"
  average={4.8}
  count="12,400"
  source="on the App Store and Google Play"
  bars={[86, 9, 3, 1, 1]}
  reviews={[
    { stars: 5, title: 'Finally stuck', text: 'Forty days of reading, which has never happened before.', name: 'Mara L.', date: 'September 2026', source: 'App Store' },
    { stars: 4, text: 'Simple and calm. I would like a darker widget.', name: 'Tomás R.', date: 'August 2026', source: 'Google Play' },
  ]}
/>

Without a key the registry answers 401 with an upgrade message. Everything this section composes is free: reveal.

Props

PropTypeDefaultDescription
averagenumbernoneThe average, 0 to 5, written with one decimal.
countstringnoneHow many rated, as written ("12,400").
bars[number, number, number, number, number]noneFive star first: counts or shares. Each bar is its share of the sum, written as a whole percentage, and drawn against the largest.
reviews{ stars; title?; text; name; date?; source? }[]noneThe reviews, in order. date is words ("September 2026"); source is where it was left.
sourcestringnoneWhere the ratings were counted, after the count ("on the App Store and Google Play").
headlinestringnoneThe section's heading. Slot "headline" wins.
eyebrowstringnoneA short line above the heading.
copystringnoneA line under the heading.
level2 | 32Heading level of the heading.
tone'surface' | 'muted' | 'ink' | 'brand'unset (paints nothing)The section's ground.
density'compact' | 'cozy' | 'roomy''cozy'Block padding ×0.8 / ×1 / ×1.25 through --ma-density.

Theming and overrides

The section reads the theme contract (shadcn's variable names with the base tokens as fallback), so a pasted theme or one --ma-brand recolours it. Its class names are the override surface and stay stable; a named slot replaces the matching prop with your own markup.

Classes

.ma-in.ma-rating.ma-rating__average.ma-rating__bars.ma-rating__big.ma-rating__body.ma-rating__by.ma-rating__copy.ma-rating__count.ma-rating__eyebrow.ma-rating__head.ma-rating__headline.ma-rating__inner.ma-rating__name.ma-rating__of.ma-rating__review.ma-rating__reviews.ma-rating__share.ma-rating__stars.ma-rating__summary.ma-rating__text.ma-rating__title.ma-rating__track

Slots

slot="headline"

Reduced motion

The bars are drawn at their length at once.

With ClientRouter

CSS and Reveal.

Why it is built this way

Replaces: Review summary widgets embedded from review platforms · Hand-built star rating breakdowns. See the migration table.

A hero for a mobile app: the headline, the rating line (stars, the average, how many rated and where) and the store buttons beside a phone on a disc of the app's colour.

every browserload

Shows big numbers that count up when scrolled into view, 120 ms apart, with labels and an optional bar under each, in a hairline row.

newly · Chrome 91 · Firefox 128 · Safari 17scroll

Shows testimonial quotes in a staggered grid.

every browserscrollpointer

Shows two rows of testimonial cards drifting in opposite directions, pausing while hovered so any quote can be read.

every browseralwayshover

Also: view transitions · how costs are measured · browser support · accessibility policy · five-minute setup · MCP for agents · this page as Markdown