Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

star-ratings-react

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

star-ratings-react

A Star Rating component made in react. Easy to customise and integrate to react applications.

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Start Rating Component

Save time and effortlessly implement a star rating system in your app without the need to write the entire code from scratch. It's easily customizable and straightforward to integrate.

star

How to use:

  • Run the following command

    npm install star-ratings-react
    
  • Import the StarRating component into your React application.

    import { StarRating } from "star-ratings-react";
    
  • Define a state variable to store the rating value in your component.

    const [rating, setRating] = useState(0);
    const [rating2, setRating2] = useState(0);
    const [rating3, setRating3] = useState(0);
    const [rating4, setRating4] = useState(0);
    
  • Add the StarRating component to your JSX, passing the state variable and the function to set the rating.

    return (
        <>
            <h1>Hello, Stars !!!</h1>
            <StarRating rating={rating} onSetRating={setRating} size={20}/>
            <StarRating rating={rating2} onSetRating={setRating2} starColor={"skyblue"} />
            <StarRating rating={rating3} onSetRating={setRating3} starColor={"white"} maxRating={5}/>
            <StarRating rating={rating4} onSetRating={setRating4} starColor={"red"} maxRating={3}/>
        </>
    );
    

Keywords

FAQs

Package last updated on 26 Dec 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc