star-based-rating

injecting star-based rating in React Applications


Keywords
react, star-based-rating, component, rating, star
License
MIT
Install
npm install star-based-rating@1.5.7

Documentation

star-based-rating

npm version license

Install

npm install star-based-rating --save

Demo

Props

I have kept minimal configurations. Less configurations Less confusions. You can edit them as well. Also you can show previous stars

<StarBasedRating 
    onSelectRatingStars={this.selectStarHandler.bind(this)} 
    totalStars={10}
    previousStarsToDisplay={3} />   

// onSelectRatingStars:  Method that you want to run after selecting
// totalStars:  Total Number of stars you want to display
// previousStarsToDisplay: Provide existing stars already

How simple is this !! 😊

Example

import React from 'react';
import ReactDOM from 'react-dom';
import StarBasedRating from 'star-based-rating'

class App extends React.Component {

 selectStarHandler(totalStarsSelected) {
        /* totalStarsSelected param is giving you 
        selected number of stars and what you want to do with it */
    }

    render() {
        return (
            <div>
                <StarBasedRating 
                onSelectRatingStars={this.selectStarHandler.bind(this)} 
                totalStars={10}
                previousStarsToDisplay={3} />
            </div>
        )
    }

}

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

MIT Licensed

😃