react-rating-stars-component vs react-stars vs react-star-rating-component
React Star Rating Components Comparison
1 Year
react-rating-stars-componentreact-starsreact-star-rating-componentSimilar Packages:
What's React Star Rating Components?

Star rating components are essential UI elements that allow users to provide feedback or rate items visually. These components enhance user experience by providing an intuitive way to express opinions on products, services, or content. The three packages mentioned offer varying features, customization options, and ease of integration, catering to different developer needs and project requirements.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
react-rating-stars-component18,64571-175 years agoISC
react-stars18,421222-478 years agoISC
react-star-rating-component9,94038170.5 kB25-MIT
Feature Comparison: react-rating-stars-component vs react-stars vs react-star-rating-component

Customization Options

  • react-rating-stars-component:

    This package offers extensive customization options, allowing developers to modify star sizes, colors, and shapes. It supports half-star ratings, which can be crucial for precise feedback. Additionally, it provides event handlers for user interactions, enabling dynamic responses to ratings.

  • react-stars:

    Customization is minimal, focusing on a straightforward star display. It is best for projects that prioritize simplicity and performance over intricate design requirements.

  • react-star-rating-component:

    Customization is limited compared to others, focusing on basic star appearance and size adjustments. It is designed for quick implementations, making it less flexible for projects requiring unique designs or behaviors.

Ease of Use

  • react-rating-stars-component:

    This package is user-friendly, with clear documentation and examples that facilitate quick integration into projects. The API is intuitive, making it easy for developers to implement and customize the component without extensive learning.

  • react-stars:

    This package is extremely easy to implement, focusing on minimal setup. It is perfect for developers looking for a quick solution without the need for extensive configuration.

  • react-star-rating-component:

    Designed for simplicity, this package is easy to set up and use, making it a good choice for beginners or projects with tight deadlines. However, it may lack some advanced features that could be beneficial for more complex applications.

Performance

  • react-rating-stars-component:

    Optimized for performance, this package ensures smooth rendering and interaction, even with complex UIs. It efficiently handles state changes and updates, making it suitable for applications with high user interaction rates.

  • react-stars:

    This package is lightweight and performs exceptionally well, making it ideal for applications where performance is critical. Its minimalistic approach ensures fast rendering and responsiveness.

  • react-star-rating-component:

    Performance is adequate for most use cases, but it may not be as optimized as others for high-frequency updates or complex interactions. Suitable for applications with moderate user engagement.

Community and Support

  • react-rating-stars-component:

    This package has a growing community and active support, with regular updates and contributions from developers. This ensures that users can find help and resources easily, enhancing the overall development experience.

  • react-stars:

    This package has a limited community presence, which may result in fewer updates and support options. It is best suited for projects where extensive community resources are not a primary concern.

  • react-star-rating-component:

    The community is smaller, but it still offers basic support and documentation. Users may find fewer resources compared to more popular packages, which could impact troubleshooting and feature requests.

Integration Flexibility

  • react-rating-stars-component:

    Highly flexible for integration with various UI frameworks and libraries, making it suitable for diverse project architectures. It can be easily adapted to work with state management libraries and other UI components.

  • react-stars:

    Designed for quick integration, this package can be easily added to projects with minimal setup. However, it may not offer the same level of flexibility for complex integrations as the other packages.

  • react-star-rating-component:

    Offers decent integration capabilities, but may require additional workarounds for more complex setups. It is best for simpler applications where integration needs are straightforward.

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

    Choose this package if you need a highly customizable star rating component with support for half-star ratings and various styles. It is ideal for projects that require a modern look and feel, along with detailed configuration options.

  • react-stars:

    Opt for this package if you require a lightweight solution with a focus on performance. It is great for applications that need a simple star rating without the overhead of additional features, making it suitable for quick integrations.

  • react-star-rating-component:

    Select this package for a straightforward implementation of star ratings with basic features. It is suitable for simpler projects where ease of use and quick setup are prioritized over extensive customization.

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:

| Property | Description | Default value | type | | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------------- | -------- | | classNames | Name of parent classes | null | string | | count | How many total stars you want | 5 | number | | value | Set rating value | 0 | number | | char | Which character you want to use as a star | ★ | string | | color | Color of inactive star (this supports any CSS valid value) | gray | string | | activeColor | Color of selected or active star | #ffd700 | string | | size | Size of stars (in px) | 15px | string | | edit | Should you be able to select rating or just see rating (for reusability) | true | boolean | | isHalf | Should component use half stars, if not the decimal part will be dropped otherwise normal algebra rools will apply to round to half stars | true | boolean | | emptyIcon | Use your own elements as empty icons | null | element | | halfIcon | Use your own elements as half filled icons | null | element | | filledIcon | Use your own elements as filled icons | null | element | | a11y | Should component be accessible and controlled via keyboard (arrow keys and numbers) | true | boolean | | onChange(new_rating) | Will be invoked any time the rating is changed | null | function |

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