react-rating vs react-star-ratings vs react-simple-star-rating vs @smastrom/react-rating
React Rating Libraries Comparison
1 Year
react-ratingreact-star-ratingsreact-simple-star-rating@smastrom/react-ratingSimilar Packages:
What's React Rating Libraries?

These libraries provide various implementations for rating components in React applications, enabling developers to easily incorporate star ratings into their user interfaces. They offer customizable options for displaying ratings, handling user interactions, and managing state, making it easier to gather feedback from users in a visually appealing manner. Each library has its own unique features and design principles, catering to different use cases and developer preferences.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
react-rating47,829520-235 years agoMIT
react-star-ratings33,522152-437 years agoBSD-3-Clause
react-simple-star-rating29,47213944.8 kB35-MIT
@smastrom/react-rating12,97936375.3 kB3a year agoMIT
Feature Comparison: react-rating vs react-star-ratings vs react-simple-star-rating vs @smastrom/react-rating

Customization Options

  • react-rating:

    Customization is limited compared to others, focusing on a straightforward implementation. Developers can change the star size and color, but advanced customization options are not as extensive.

  • react-star-ratings:

    Offers a range of customization options, including the ability to set star dimensions, colors, and the ability to display half-star ratings. This makes it suitable for applications that require more detailed feedback.

  • react-simple-star-rating:

    This package emphasizes simplicity, providing basic customization options such as star size and color. It is designed for quick setups and minimal configuration, making it easy to use for simple projects.

  • @smastrom/react-rating:

    This library offers extensive customization options, allowing developers to modify the appearance of the rating stars, including size, color, and hover effects. It supports both controlled and uncontrolled components, giving developers flexibility in managing state.

Ease of Use

  • react-rating:

    This library is very easy to use, with a simple API that allows for quick integration into any React project. It is ideal for developers looking for a no-fuss solution for star ratings.

  • react-star-ratings:

    While slightly more complex than the simplest options, it still maintains a user-friendly API. It is easy to implement and provides clear documentation, making it accessible for most developers.

  • react-simple-star-rating:

    True to its name, this library is extremely easy to implement. It requires minimal setup and is perfect for developers who want to add a rating component without much overhead.

  • @smastrom/react-rating:

    Designed with modern React practices in mind, this library is easy to integrate with existing projects. It provides a clear API and examples, making it beginner-friendly while still being powerful for advanced users.

Performance

  • react-rating:

    Performance is adequate for basic use cases, but it may not be as optimized for larger applications where many components are re-rendering frequently.

  • react-star-ratings:

    Offers good performance with the ability to handle complex interactions, but developers should be mindful of potential re-renders in larger applications.

  • react-simple-star-rating:

    This library is lightweight and performs well in most scenarios, making it suitable for applications that require quick loading times and responsiveness.

  • @smastrom/react-rating:

    Optimized for performance, this library minimizes re-renders and efficiently manages state changes. It leverages React's hooks to ensure that updates are handled smoothly without unnecessary overhead.

Documentation and Community Support

  • react-rating:

    Has decent documentation and a stable user base. It is widely used, so finding community support and resources is relatively easy.

  • react-star-ratings:

    Comprehensive documentation and a solid community presence. This library has been around longer, providing a wealth of resources and examples for developers.

  • react-simple-star-rating:

    Documentation is straightforward and easy to follow, making it accessible for beginners. Community support is limited but sufficient for basic use cases.

  • @smastrom/react-rating:

    Well-documented with examples and a growing community. This package is relatively new but gaining traction, making it a good choice for developers looking for modern solutions.

Compatibility and Dependencies

  • react-rating:

    Compatible with a wide range of React versions, but may not leverage the latest React features, which could limit its use in newer applications.

  • react-star-ratings:

    Compatible with most React versions and has no significant dependencies, ensuring smooth integration into various projects.

  • react-simple-star-rating:

    Designed to work with modern React, ensuring compatibility with the latest features. It has no external dependencies, making it lightweight and easy to include.

  • @smastrom/react-rating:

    Built with modern React features, ensuring compatibility with the latest versions of React. It has minimal dependencies, making it easy to integrate into existing projects.

How to Choose: react-rating vs react-star-ratings vs react-simple-star-rating vs @smastrom/react-rating
  • react-rating:

    Opt for this library if you prefer a simple and straightforward implementation for star ratings with minimal setup. It is ideal for projects that require basic rating functionality without extensive customization.

  • react-star-ratings:

    Consider this library if you need a more feature-rich rating component that supports half-star ratings and provides a variety of customization options. It is suitable for applications that require a more detailed rating system.

  • react-simple-star-rating:

    Select this package if you want a lightweight solution with a focus on simplicity and ease of use. It is perfect for quick implementations where you need a star rating component that is easy to integrate and style.

  • @smastrom/react-rating:

    Choose this package if you need a highly customizable rating component that supports both controlled and uncontrolled states, and if you want to leverage modern React features such as hooks for better state management.

README for react-rating

npm version

React Rating

React Rating is a react rating component which supports custom symbols both with inline styles and glyphicons found in popular CSS Toolkits like Fontawesome or Bootstrap.

This React component was inspired by the jQuery plugin bootstrap-rating.

Demo

See react-rating in action.

Installation

You can install react-rating component using the npm package manager:

npm install --save react-rating

Dependencies

The react-rating component peer depends on the React library.

You can install React using npm too:

npm install --save react

Upgrade Warning

If you are using a version of React Rating < v1.0 be aware that there are API changes between anything < v1.0 and v1.0 . See the Properties and Deprecated Properties and Callbacks sections below for a documentation of the current API and how it compares to the old.

Usage

  1. Require the Rating Component

    var Rating = require('react-rating');
    
  2. Start using it

    With raw javascript:

    React.createElement(Rating)
    

    Or with JSX:

    <Rating />
    

Properties

Property | Type | Default | Description --- | --- | --- | --- start | number | 0 | Range starting value (exclusive). stop | number | 5 | Range stop value (inclusive). step | number | 1 | Describes how many values each Symbol represents. For example, for a start value of 0, a stop value of 10 and a step of 2, we will end up with 5 Symbols, with each Symbol representing value increments of 2. fractions | number | 1 | Number of equal subdivisions that can be selected as a rating in each Symbol. For example, for a fractions value of 2, you will be able to select a rating with a precision of down to half a Symbol. Must be >= 1 initialRating | number | 0 | The value that will be used as an initial rating. This is the old initialRate. placeholderRating | number | 0 | If you do not define an initialRating value, you can use a placeholder rating. Visually, this will have the same result as if you had defined an initialRating value. If initialRating is set placeholderRating is not taken into account. This is the old placeholderRate readonly | bool | false | Whether the rating can be modified or not. quiet | bool | false | Whether to animate rate hovering or not. direction | ltr or rtl | ltr | The direction of the rating element contents emptySymbol | element or object or string or array | Style.empty | React element, inline style object, or classes applied to the rating symbols when empty. Can also be an array of such symbols that will be applied in a circular manner (round-robin). This is the old empty. fullSymbol | element or object or string or array | Style.full | React element, inline style object, or classes applied to the rating symbols when full. Can also be an array of such symbols that will be applied in a circular manner (round-robin). This is the old full. placeholderSymbol | element or object or string or array | Style.placeholder | React element, inline style object, or classes applied to the placeholder rating symbols. Can also be an array of such symbols that will be applied in a circular manner (round-robin). This is the old placeholder.

Callbacks

Callback | Type | Description --- | --- | --- onChange | function (value) {} | Gets called with the value when a different value than the currently set is selected. onClick | function (value) {} | Gets called with the value when a symbol is clicked. The value is equal to the value that corresponds to that part of the symbol. onHover | function (value) {} | Gets called with the value when you hover over a symbol. The value is equal to the value that corresponds to that part of the symbol. Gets called in quiet mode too. When hover ends, gets called with no value (i.e. undefined as the value).

Deprecated Properties and Callbacks

This is a list of deprecated properties and callbacks from versions older than v1.0

  • onRate
  • initialRate
  • placeholderRate
  • empty
  • full
  • placeholder

License

MIT License