react-stars-rting is a react component that allows you to add ratings to your applications.
$ npm install react-stars-rating --saveor
$ yarn add react-stars-ratingimport StarsRating from 'react-stars-rating';import React from 'react';
import StarsRating from 'react-stars-rating';
class MyComponent extends React.Component {
render() {
return (
<StarsRating rating={3} />
);
}
}
React.render(<MyComponent />, document.getElementById('app'));| Prop Name | Type | Default | Required | Description |
|---|---|---|---|---|
| name | String | rating-123456 (timestamp) | false | name of the rating used when the component is inside a form |
| disabled | Boolean | false | false | disable the stars |
| insideForm | Boolean | false | false | is the rating stars inside a form |
| onRatingClick | Function | () => false | false | the callback used by the parent component. Call when a star is clicked |
| rating | Number | true | the rating to display | |
| theme | String | orange | false | theme color |
This component is inspired by the following codepen by Joseph Fusco and also many thanks to the guys from Marvel for having such a perfect color scheme.
