star-based-rating

1.5.7 • Public • Published

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

😃

Package Sidebar

Install

npm i star-based-rating

Weekly Downloads

1

Version

1.5.7

License

MIT

Unpacked Size

11.4 kB

Total Files

3

Last publish

Collaborators

  • 34priyanka