Skip to content
An example React project that displays a star-based rating.
Branch: master
Clone or download
Latest commit a0e61d1 Jun 12, 2018

React Star-Rating

This is a sample React project, built around a StarRating component which displays stars and half-stars based on the inputs you give it, similar to what you might see on Amazon or other ecommerce websites.


git clone react-star-rating
cd react-star-rating
npm install
npm start

This should open a page on your browser to the demo app. If not, you should be able to access it via localhost:3000.

How To Use

Change the inputs via the inputs section:

  • Rating changes the actual rating.
  • Min Rating sets the lower limit for a rating.
  • Max Rating sets the upper limit for a rating.
  • Star Ratio sets how many rating points are required to add a star.

Updating the input values should show in the field of stars below the React logo. Visually, increments only occur in half-stars, but you can set the rating to anything you want.

I Want To Use This In A Real App

This is just a sample project. It was not designed for inclusion in a real app. That said, if it inspires you, that's awesome!

You can’t perform that action at this time.