Ratings Stars
Ratings Stars show the current rating for a product, on a scale of 1 to 5. The rating itself can have one decimal place, e.g. a rating of 3.4.
<RatingsStars ratingValue={3.5} aria-label="Rating: 3.5 out of 5 stars" />
<div class="ratings-stars" role="img" aria-label="3.5 out of 5 stars"><spanclass="ratings-stars-star ratings-stars-star-filled"role="presentation"></span><spanclass="ratings-stars-star ratings-stars-star-filled"role="presentation"></span><spanclass="ratings-stars-star ratings-stars-star-filled"role="presentation"></span><spanclass="ratings-stars-star ratings-stars-star-filled ratings-stars-star-filled-p5"role="presentation"></span><span class="ratings-stars-star" role="presentation"></span></div>
Stars to Show
If you only want to show a single star, you can adjust the number of stars to show to 1. This allows you to show a filled star using a rating of 1, and an empty star using a rating of 0.
"monochromatic" skin
The "monochromatic" skin turns the stars black -- or white when using dark mode. This is intended for use only when the stars are shown on top of a light-colored background such as a hero or banner.
<RatingsStars skin="monochromatic" ratingValue={3} starsToShow={5} />
<div class="ratings-stars ratings-stars-skin-monochromatic"><span class="ratings-stars-star ratings-stars-star-filled"></span><span class="ratings-stars-star ratings-stars-star-filled"></span><span class="ratings-stars-star ratings-stars-star-filled"></span><span class="ratings-stars-star"></span><span class="ratings-stars-star"></span></div>
Guidelines
Accessibility Guidelines
The contents of the Ratings Stars component are not visible to assistive technologies, so the component needs an
aria-label
attribute that describes its contents, such as "Rating: 3.5 out of 5 stars". (Compare this toalt
text on an image.)