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

react-rating-star-with-type

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-rating-star-with-type

This simple react rating star component with typescript support made by Ziaul Hoque Founder of Revuers.com

  • 1.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
403
increased by11.02%
Maintainers
1
Weekly downloads
 
Created
Source

react-stars :star:

A simple star rating component for your React projects

React Rating stars

Get started quickly

Install react-stars package with NPM:

npm install react-rating-star-with-type --save

Install react-stars package with Yarn:

yarn add react-rating-star-with-type

Then in your project include the component:

import { useState } from "react";
import ReactStars from 'react-rating-star-with-type'

export default function app(){
    const [star, setStar] = useState(5);

    const onChange=(nextValue)=>{
        setStar(nextValue)
    }
    
    return <ReactStars 
    onChange={onChange} 
    value={4.2}  
    isEdit={true}  
    activeColors={[ "red", "orange", "#FFCE00", "#9177FF","#8568FC",]} 
    />
}




API

This a list of props that you can pass down to the component:

PropertyDescriptionDefault valuetype
classNameName of wrapper class""string
countHow many total stars you want5number
valueSet rating value0number
emptyIconWhich character you want to use as a star(react-icons)ReactNode
halfIconWhich character you want to use as a half star(react-icons)ReactNode
filledIconWhich character you want to use as a active star(react-icons)ReactNode
inactiveColorColor of inactive star#808080string
activeColorsColors of active star (depend of value)[]String[]
activeColorColor of selected or active star#FED900string
sizeSize of stars (if provide string you must mention unit , for example: "1rem" )14number or String
stylestyle object for component wrapper{}object
isEditShould you be able to select rating or just see rating (for reusability)falseboolean
isHalfisHalf true means you can select half star (make sure isEdit true if you set isHalf true)falseboolean
valueShowShould component use valueShow, if need Rating show with starsfalseboolean
onChange(new_rating)Will be invoked any time the rating is changedundefinedfunction

Help improve the component

Hit star on gitHub - https://github.com/ziaulhoque24/react-rating-star-with-type

Requirements

You will need to have React in your project in order to use the component, I didn't bundle React in the build, because it seemed like a crazy idea.

It also works perfectly with next js in client components. with the server component, you may get an error!

Keywords

FAQs

Package last updated on 31 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