react-rating-stars-component vs react-star-rating-component vs react-star-ratings
React Star Rating Components
react-rating-stars-componentreact-star-rating-componentreact-star-ratingsSimilar Packages:

React Star Rating Components

Star rating components are essential UI elements used to gather user feedback through a visual representation of ratings, typically in the form of stars. These components enhance user experience by allowing quick and intuitive input of ratings for products, services, or content. The three packages listed provide various functionalities and customization options, catering to different project requirements and developer preferences.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
react-rating-stars-component071-176 years agoISC
react-star-rating-component037870.5 kB24-MIT
react-star-ratings0154-438 years agoBSD-3-Clause

Feature Comparison: react-rating-stars-component vs react-star-rating-component vs react-star-ratings

Customization

  • react-rating-stars-component:

    This package offers extensive customization options, allowing developers to change the number of stars, colors, and sizes. It also supports half-star ratings, which can enhance user feedback accuracy.

  • react-star-rating-component:

    Customization is limited compared to others, focusing on basic star configurations. It allows for some styling but lacks advanced features like half-star ratings, making it less flexible for unique designs.

  • react-star-ratings:

    Provides moderate customization options, allowing developers to set the number of stars and colors. However, it does not support half-star ratings, which may limit its use in certain scenarios.

Ease of Use

  • react-rating-stars-component:

    This package is designed for ease of use, with a simple API that allows for quick integration into any React project. The documentation is clear and provides examples for various use cases.

  • react-star-rating-component:

    The API is straightforward, making it easy for developers to implement. However, its simplicity may limit its functionality for more complex requirements.

  • react-star-ratings:

    This package has a slightly steeper learning curve due to its more advanced features, but it is still user-friendly for developers familiar with React.

Performance

  • react-rating-stars-component:

    Optimized for performance, this package minimizes re-renders and efficiently handles user interactions, making it suitable for applications with high user engagement.

  • react-star-rating-component:

    Performance is adequate for small applications, but it may struggle with larger datasets or frequent updates due to its simplicity.

  • react-star-ratings:

    Designed with performance in mind, it efficiently manages state and updates, making it suitable for applications that require handling many ratings.

Community Support

  • react-rating-stars-component:

    Has a growing community and active maintenance, ensuring that developers can find support and updates regularly.

  • react-star-rating-component:

    This package has a smaller community, which may result in limited support and fewer updates over time.

  • react-star-ratings:

    Benefits from a moderate level of community support, with sufficient resources available for troubleshooting and implementation.

Documentation

  • react-rating-stars-component:

    Comprehensive documentation with examples and use cases, making it easy for developers to understand and implement the component effectively.

  • react-star-rating-component:

    Documentation is basic and may lack detailed examples, which could hinder new users from fully utilizing its capabilities.

  • react-star-ratings:

    Offers decent documentation, but it may not be as extensive as that of the other packages, potentially making it harder for beginners to get started.

How to Choose: react-rating-stars-component vs react-star-rating-component vs react-star-ratings

  • react-rating-stars-component:

    Choose this package if you need a highly customizable star rating component that supports half-star ratings and allows for easy styling through CSS. It is ideal for projects where visual appearance and user interaction are paramount.

  • react-star-rating-component:

    Select this package if you are looking for a straightforward and lightweight solution with basic star rating functionality. It is suitable for simple applications where minimal features are needed without extensive customization.

  • react-star-ratings:

    Opt for this package if you require a robust solution that supports both controlled and uncontrolled components, along with a focus on performance. It is a good choice for applications that need to handle a large number of ratings efficiently.

README for react-rating-stars-component

react-rating-stars-component :star:

Forked from react-stars: https://github.com/n49/react-stars
A simple star rating component for your React projects (now with half stars and custom characters)

react-stars

DEMO: https://codesandbox.io/s/elegant-mountain-w3ngk?file=/src/App.js

Get started quickly

Install react-stars package with NPM:

npm install react-rating-stars-component --save

Then in your project include the component:

import ReactStars from "react-rating-stars-component";
import React from "react";
import { render } from "react-dom";

const ratingChanged = (newRating) => {
  console.log(newRating);
};

render(
  <ReactStars
    count={5}
    onChange={ratingChanged}
    size={24}
    activeColor="#ffd700"
  />,

  document.getElementById("where-to-render")
);

Or use other elements as icons:

We do not support CSS for other third party libraries like fontawesome in this case. So you must import it by urself.

react-stars-fa

import ReactStars from "react-rating-stars-component";
import React from "react";
import { render } from "react-dom";

const ratingChanged = (newRating) => {
  console.log(newRating);
};

render(
  <ReactStars
    count={5}
    onChange={ratingChanged}
    size={24}
    isHalf={true}
    emptyIcon={<i className="far fa-star"></i>}
    halfIcon={<i className="fa fa-star-half-alt"></i>}
    fullIcon={<i className="fa fa-star"></i>}
    activeColor="#ffd700"
  />,

  document.getElementById("where-to-render")
);

API

This a list of props that you can pass down to the component:

PropertyDescriptionDefault valuetype
classNamesName of parent classesnullstring
countHow many total stars you want5number
valueSet rating value0number
charWhich character you want to use as a starstring
colorColor of inactive star (this supports any CSS valid value)graystring
activeColorColor of selected or active star#ffd700string
sizeSize of stars (in px)15pxstring
editShould you be able to select rating or just see rating (for reusability)trueboolean
isHalfShould component use half stars, if not the decimal part will be dropped otherwise normal algebra rools will apply to round to half starstrueboolean
emptyIconUse your own elements as empty iconsnullelement
halfIconUse your own elements as half filled iconsnullelement
filledIconUse your own elements as filled iconsnullelement
a11yShould component be accessible and controlled via keyboard (arrow keys and numbers)trueboolean
onChange(new_rating)Will be invoked any time the rating is changednullfunction

Help improve the component

Build on your machine:
# Clone the repo
git clone git@github.com:ertanhasani/react-stars.git
# Go into project folder
cd react-stars
# Install dependancies
npm install

Build the component:

npm build

Run the examples (dev):

npm run dev-example

Build the examples (production):

npm run build-example

Then in your browser go to: http://127.0.0.1:8080/example

Requirements

You will need to have React in your project in order to use the component, I didn't bundle React in the build, because it seemed like a crazy idea.

Todo

  • Make better docs
  • Better state management
  • Write tests