ValyroUI Русская версия

Reviews Summary

Reviews: average rating, filterable histogram, sorting and helpful votes. Pro · Shop and payments › Catalog

Ratings overview and review list: average and histogram (bars filter the list), sort, verified-only filter, helpful votes and pagination.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add reviews-summary
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { ReviewsSummary } from 'valyro-ui-pro';

Props

PropTypeDefault
reviews *ReviewData[]Reviews to list; sorting, the rating and verified filters and paging are applied to them here.
statsReviewStatsTotals from the server when reviews is only part of them; computed from reviews otherwise.
titleReactNodeHeading; null hides it. Default "Customer reviews".
sort'recent' | 'helpful' | 'highest' | 'lowest'Controlled sort; use with onSortChange.
defaultSort'recent' | 'helpful' | 'highest' | 'lowest''recent'Initial sort when uncontrolled.
onSortChange(sort: ReviewSort) => voidCalled with the new sort when it changes.
ratingnumber | nullWhole-star rating the list is filtered to (set by the histogram), or null.
defaultRatingnumber | nullnullInitial rating when uncontrolled.
onRatingChange(rating: number | null) => voidCalled with the new rating when it changes.
verifiedOnlybooleanControlled verifiedOnly; use with onVerifiedOnlyChange.
defaultVerifiedOnlybooleanfalseInitial verifiedOnly when uncontrolled.
onVerifiedOnlyChange(verifiedOnly: boolean) => voidCalled with the new verifiedOnly when it changes.
votesRecord<string, ReviewVote>The viewer's votes by review id.
defaultVotesRecord<string, ReviewVote>{}Initial votes when uncontrolled.
onVotesChange(votes: Record<string, ReviewVote>) => voidCalled with the new votes when it changes.
pageSizenumber5Reviews per page. Default 5.
onWriteReview() => voidShows a "Write a review" button.
headingLevel2 | 3 | 42Heading level of the title; review titles use the next level. Default 2.
localestringBCP 47 locale for numbers and dates; defaults to the ThemeProvider's, then the browser's.
labelsPartial<ReviewsSummaryLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Product Spotlight · Next: Guided Product Finder · All Shop and payments