Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-custom-rating-component
Advanced tools
Readme
Customizable react star ratings. It allows use of different precisions and supports custom icon like heart icon
npm install react-custom-rating-component
Or
yarn add react-custom-rating-component
I wanted a star rating component that was highly customizable and could do half stars, and I wanted it to be declarative. I couldn't find one that I liked, so I made one.
Check out the playground with different use cases Play Ground
import { Rating } from 'react-custom-rating-component'
const App = () => {
return (
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
margin: '40px 20px',
}}
>
<Rating
defaultValue={2.5}
size='30px'
spacing='10px'
activeColor='red'
onChange={(newRating) => console.log('newRating', newRating)}
onHover={(hoveredRating) => console.log('hoveredRating', hoveredRating)}
/>
</div>
)
}
Prop | Type | Default | Description |
---|---|---|---|
defaultValue | string | 0 | Required. This is the value of the rating displayed by default. Supply this if your rating is also a readOnly |
precision | number | 1 | The value to increment rating when hovered or clicked |
count | number | 5 | The number of Icons to display |
shape | star or heart | star | This is the shape displayed as icon |
onChange | function | - | This is the function that is called when the rating value changes |
onHover | function | - | This is the function that is called when the rating Icon is hovered |
className | string | '' | classes passed to the parent component |
readOnly | boolean | false | This sets the component to be non editable |
size | string | 24px | This defines the size of the Icons used |
spacing | string | 5px | This defines the fap between the Icons used |
activeColor | string | orange | This is the color of the icon in the active state |
defaultColor | string | gray | This is the color of the icon in the inactive state |
titleArray | string[] | ['Poor', 'Good', 'Very Good', 'Best', 'Excellent'] | These are displayed as titles when icons are hovered |
showTitle | boolean | false | This defines whether to display the titles or not |
This library is supported by all the major browsers. If you find any issues please raise an issue on the repo and I will attend to it as soon as possible.
If you have any ideas on how to make this library better, please feel free to contribute by raising a PR or an issue. I will be happy to review and merge.
FAQs
A fully customizable rating component for react and next.js
The npm package react-custom-rating-component receives a total of 40 weekly downloads. As such, react-custom-rating-component popularity was classified as not popular.
We found that react-custom-rating-component demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.