Honest Rating

Honest Rating is a copy-paste React component that stops trusted a 5.0 from three reviews before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/honest-rating
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsTrusted a 5.0 from three reviews

Was this component page useful?

How do I install Honest Rating?

pnpm dlx shadcn@latest add @bollard/honest-rating

The files land in your project. They're yours to edit.

How do I use Honest Rating in React?

honest-rating-usage.tsx
import { bayesianScore, HonestRating, ratingStats, type RatingDistribution } from "@/components/ui/honest-rating"

<HonestRating key={picked} distribution={products[picked].distribution} onSelectStars={setFilter} />

What input mistakes does Honest Rating catch?

  • Ratings backed by very few reviews, with a likely range for the true score
  • Polarised splits hidden by an average
  • Sorting by raw average: a Bayesian score (IMDb-style) is offered instead
  • Optional link to read the low reviews first

What props does Honest Rating accept?

HonestRating props
PropTypeDefault
distribution* (required)

Review counts for 1★ to 5★.

RatingDistribution—
minReviews

Below this many reviews the score is flagged as a tiny sample.

number10
prior

Prior for the sorting score; pass your catalogue's mean.

RatingPriorDEFAULT_PRIOR
onSelectStars

Called when a star row (or "Read the 1★ reviews") is chosen, to filter the reviews below.

(stars: number) => void—
countText

Templates: `{count}`, `{low}`, `{high}`, `{one}`, `{five}`, `{score}`, `{mean}`.

string"from {count}"
smallSampleText

Shown when the review count is below minReviews.

string"Only {count}: the real score could be anywhere from {low…
polarizedText

Shown for a love-it-or-hate-it split.

string"Split opinions: {one} gave 1★ and {five} gave 5★. The av…
adjustedText

Explains the Bayesian sorting score.

string"Ranked as {score} when sorting, pulled toward {mean} unt…
readLowLabel

Button text to read the 1-star reviews.

string"Read the 1★ reviews"
emptyText

Shown when there are no reviews.

string"No reviews yet"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Honest Rating accessible?

  • Breakdown is a labelled list with text labels for each star level
  • The likely-range bar is role=img with an aria-label stating the range
  • Warnings are in a polite live region with text, not only icons
  • Star filters are real buttons, disabled when a level has no reviews

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Statistics assume reviews are genuine; it does not detect fake or incentivised reviews
  • The prior and weight you pass change the Bayesian score; defaults may not suit your catalogue
  • The likely range is an approximation (Dirichlet, 90%), not an exact interval

What expensive mistakes does Honest Rating stop?

Trusted a 5.0 from three reviews

Also known as

star rating · reviews · ratings · bayesian average · product page · flipkart · amazon · sort by rating

Field type

What dependencies does Honest Rating require?

Honest Rating facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameHonest Rating
Registry identifier@bollard/honest-rating
Install commandnpx shadcn@latest add @bollard/honest-rating
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Honest Rating

How does Honest Rating prevent financial transaction errors?

Honest Rating prevents trusted a 5.0 from three reviews. Blocks Ratings backed by very few reviews, with a likely range for the true score, Polarised splits hidden by an average, Sorting by raw average: a Bayesian score (IMDb-style) is offered instead, Optional link to read the low reviews first before processing. Limitation: apply idempotency keys for honest-rating.

How do I install honest-rating with shadcn?

Run `npx shadcn@latest add @bollard/honest-rating`. Sources added: registry/default/honest-rating/honest-rating.tsx. Package requirements: lucide-react.

What props customize Honest Rating?

Honest Rating accepts `distribution`, `minReviews`, `prior`, `onSelectStars`, `countText`. Configures star rating, reviews, ratings behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of honest-rating?

Statistics assume reviews are genuine; it does not detect fake or incentivised reviews. The prior and weight you pass change the Bayesian score; defaults may not suit your catalogue. The likely range is an approximation (Dirichlet, 90%), not an exact interval Server requirement: backend verification for honest-rating.

How does Honest Rating meet accessibility guidelines?

Breakdown is a labelled list with text labels for each star level. The likely-range bar is role=img with an aria-label stating the range. Warnings are in a polite live region with text, not only icons. Star filters are real buttons, disabled when a level has no reviews. Minimizes errors: fake high rating, few reviews high stars.

Which components pair with Honest Rating?