1.2.2 • Published 4 months ago

react-rating-star-with-type v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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!

1.2.2

4 months ago

1.2.1

9 months ago

1.2.0

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago