
Security News
Security Community Slams MIT-linked Report Claiming AI Powers 80% of Ransomware
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.
reactjs-star-rating
Advanced tools
ReactJS Star Rating is a flexible and customizable star rating component that supports both full and half-star ratings. It comes with features like custom labels, read-only mode, hover effects, and custom styling, making it perfect for any React project.

Using npm:
npm install reactjs-star-rating
Using yarn:
yarn add reactjs-star-rating
import StarRating from "reactjs-star-rating";
function App() {
  return <StarRating defaultRating={3} maxRating={5} />;
}
| Prop | Type | Default | Description | 
|---|---|---|---|
| maxRating | number | 5 | Maximum rating value | 
| color | string | "#fcc419" | Color of the stars | 
| size | number | 48 | Size of stars in pixels | 
| className | string | "" | Custom CSS class name | 
| defaultRating | number | 0 | Initial rating value | 
| readOnly | boolean | false | Makes the rating read-only | 
| showLabel | boolean | true | Shows/hides the rating label | 
| labels | string[] | [] | Custom labels for ratings | 
| onSetRating | function | undefined | Callback when rating changes | 
| allowHalf | boolean | false | Enables half-star ratings | 
<StarRating defaultRating={3} maxRating={5} />
<StarRating
  allowHalf
  defaultRating={2.5}
  maxRating={5}
  color="purple"
  onSetRating={(rating) => console.log(rating)}
/>
<StarRating
  maxRating={5}
  showLabel={true}
  labels={["Poor", "Fair", "Good", "Very Good", "Excellent"]}
  defaultRating={3}
  color="green"
/>
<StarRating defaultRating={4} maxRating={5} readOnly color="blue" />
<StarRating
  maxRating={5}
  onSetRating={(rating) => {
    console.log(`Selected rating: ${rating}`);
  }}
/>
<StarRating
  maxRating={5}
  className="custom-star-rating"
  size={32}
  color="#ff9800"
/>
You can customize the appearance using CSS by targeting the provided className:
.custom-star-rating {
  /* Your custom styles */
  background: #f5f5f5;
  padding: 10px;
  border-radius: 8px;
}
Contributions are welcome! Please feel free to submit a Pull Request.
MIT © Varshil Shah
Made with ❤ by Varshil Shah from 🇮🇳
FAQs
This is a simple star rating component for ReactJS.
We found that reactjs-star-rating 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
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.