React Star Rating Component

Basic React component for star (or any other icon based) rating elements
Alternatives To React Star Rating Component
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Raty2,332
2 months ago60mitJavaScript
:star2: Raty - A Star Rating Plugin
Smileyrating1,003
3 years ago1June 18, 20197apache-2.0Java
SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.
React Native Star Rating735220362 years ago11September 10, 201848JavaScript
A React Native component for generating and displaying interactive star ratings
Edstarrating425
716 years ago3March 24, 201518Objective-C
Configurable Star Rating control for iOS and OSX
React Star Rating Component322360333 years ago10March 04, 201819mitJavaScript
Basic React component for star (or any other icon based) rating elements
Vue Rate213
9a year ago26May 16, 20221mitVue
Rate component for Vue
Material Ui Rating904023 months ago21August 14, 20191mitJavaScript
Rate something with style.
Angular Input Stars76515 years ago1April 28, 20167HTML
Create rating inputs easily
Heartrate73
8 months ago1mitC#
Bluetooth heart rate monitor
Css Star Rating659255 months ago16June 06, 20229mitSCSS
Css Star Rating is a css only star rating lib based on best practice UX/UI methodes. It is written in scss and fully customizable.
Alternatives To React Star Rating Component
Select To Compare


Alternative Project Comparisons
Readme

react-star-rating-component

npm version Dependency Status Download Count

Tiny React.js component for star (or any other icon based) ratings.

Install

npm install react-star-rating-component --save

Demo

Props

<StarRatingComponent
    name={String} /* name of the radio input, it is required */
    value={Number} /* number of selected icon (`0` - none, `1` - first) */
    starCount={Number} /* number of icons in rating, default `5` */
    onStarClick={Function(nextValue, prevValue, name)} /* on icon click handler */
    onStarHover={Function(nextValue, prevValue, name)} /* on icon hover handler */
    onStarHoverOut={Function(nextValue, prevValue, name)} /* on icon hover out handler */
    renderStarIcon={Function(nextValue, prevValue, name)} /* it should return string or react component */
    renderStarIconHalf={Function(nextValue, prevValue, name)} /* it should return string or react component */
    starColor={String} /* color of selected icons, default `#ffb400` */
    emptyStarColor={String} /* color of non-selected icons, default `#333` */
    editing={Boolean} /* is component available for editing, default `true` */
/>

Examples

Editable

import React from 'react';
import ReactDOM from 'react-dom';
import StarRatingComponent from 'react-star-rating-component';

class App extends React.Component {
  constructor() {
    super();

    this.state = {
      rating: 1
    };
  }

  onStarClick(nextValue, prevValue, name) {
    this.setState({rating: nextValue});
  }

  render() {
    const { rating } = this.state;
    
    return (                
      <div>
        <h2>Rating from state: {rating}</h2>
        <StarRatingComponent 
          name="rate1" 
          starCount={10}
          value={rating}
          onStarClick={this.onStarClick.bind(this)}
        />
      </div>
    );
  }
}

ReactDOM.render(
  <App />, 
  document.getElementById('app')
);

Non-editable (with custom icons)

import React from 'react';
import ReactDOM from 'react-dom';
import StarRatingComponent from 'react-star-rating-component';

class App extends React.Component {
  render() {
    const { rating } = this.state;

    return (                
      <div>
        <h2>Rating from state: {rating}</h2>
        <StarRatingComponent 
          name="rate2" 
          editing={false}
          renderStarIcon={() => <span></span>}
          starCount={10}
          value={8}
        />
      </div>
    );
  }
}

ReactDOM.render(
  <App />, 
  document.getElementById('app')
);

Check more in examples folder.


MIT Licensed

Popular Rating Projects
Popular Icon Projects
Popular User Interface Components Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Reactjs
Icon
Rating
React Component