React Storefront
|

Rating

import Rating from 'react-storefront/Rating'

Props

NameTypeDefaultDescription
classesobject

CSS classes to apply

valuenumber

The number of stars to display. Can be an integer or a float ending in .5.

reviewCountnumber

The number of reviews

labelfuncreviewCount => <span> {reviewCount == 1 ? 'review' : 'reviews'}</span>

A function that returns the label displayed to the right of the review count. For example: <Rating label={reviewCount => <span> {reviewCount == 1 ? 'review' : 'reviews'}</span>}/>. This value used in this example is the default.

productobject

An instance of ProductModelBase. You can set this instead of setting value an reviewCount individually.

iconFullfunc

Custom full point icon

iconHalffunc

Custom half point icon

iconEmptyfunc

Custom empty icon, will override fillEmpty icon

fillEmptyboolfalse

Use filled icon with light grey background for empty icon

CSS API

You can override all the class names injected by Moov-PWA thanks to the classes property. This property accepts the following keys:

  • root
  • filledEmpty
  • blank
  • reviewsLabel