Socket
Socket
Sign inDemoInstall

react-star-ratings-component

Package Overview
Dependencies
4
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-star-ratings-component

React-Star-Rating-Component is a simple to use yet completely customizable component for using Rating/Reviews.


Version published
Weekly downloads
121
increased by35.96%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React-Star-Rating-Component

React-Star-Rating-Component is a simple to use yet completely customizable component for using Rating/Reviews.

  • Fully CSS customizable - Change number of star, color, size and space between star ratings

Installation

This requires [React.js and Prop-Types] to run.

npm i react-star-ratings-component

Demo

Sandbox link to Play with

How to Use

Install and import react-star-ratings-component and pass the props as per the below table

import React from "react";
import ReactStarRating from "react-star-ratings-component";

const App = () => {
  return (
    <ReactStarRating
      numberOfStar={10}
      numberOfSelectedStar={2}
      colorFilledStar="red"
      colorEmptyStar="black"
      starSize="20px"
      spaceBetweenStar="10px"
      disableOnSelect={false}
      onSelectStar={val => {
        console.log(val);
      }}
    />
  );
};
export default App;

Prop-Types

Details of the Props to be passed:

Prop-nameTypeDescription
numberOfStarNumberThis determines the maximum number of Stars or Rating in the Component.
numberOfSelectedStarNumberThis determines the number of Stars or Rating selected in the Component.
numberOfStarNumberThis determines the maximum number of Stars or Rating in the Component.
colorFilledStarstringColor of selected Stars or Rating.
colorEmptyStarstringColor of Stars or Rating.
starSizestringThis determines the size of the Star or Rating.
colorEmptyStarstringThis determines the space between the Star or Rating.
disableOnSelectbooleanDisable or enable the user action in the component.
onSelectStarfuncCallback function which returns the position of nth star on click of the component

Default proptypes

ReactStarRating.defaultProps = {
  numberOfStar: 5,
  colorFilledStar: "orange",
  colorEmptyStar: "#000",
  starSize: "20px",
  spaceBetweenStar: "10px",
  disableOnSelect: true
};

Keywords

FAQs

Last updated on 13 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc