material-star-rating

1.0.13 • Public • Published

Material Star Rating

Installation

  • Run npm install material-star-rating in your project.
  • Import in your project using import Rating from 'material-star-rating';

Usage

<Rating {...props} />

Props

  • isBig (optional | boolean | default:false) - changes the size of the stars
  • interactive (optional | boolean | default:false) - makes the stars interactive
  • handleRate (optional, required if interactive | function | default:null) - handles the rating if the stars are interactive
  • value (optional | number | default:0) - the number of filled stars (can have decimal numbers)

Sample Usage

import React from 'react';
import Rating from 'material-star-rating;
 
 
const Component = () => {
    const [rating, setRating] = React.useState(1);
    const handleRate = (val) => setRating(val);
    
    return <Rating interactive handleRate={handleRate} value={rating} isBig />
}
 
 
export default Component;

Demo

Live demo

Package Sidebar

Install

npm i material-star-rating

Weekly Downloads

8

Version

1.0.13

License

MIT

Unpacked Size

103 kB

Total Files

4

Last publish

Collaborators

  • cyrilcabo