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

@gietmanic/react-star-rating

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gietmanic/react-star-rating

A simple and customizable star rating component for React

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-95%
Maintainers
0
Weekly downloads
 
Created
Source

React Star Rating Component

npm version License: MIT TypeScript

A simple, customizable, and accessible star rating component for React applications.

📦 Installation

npm install @gietmanic/react-star-rating
# or
yarn add @gietmanic/react-star-rating
# or
pnpm add @gietmanic/react-star-rating 

✨ Features

  • 🌟 Customizable number of stars (min/max)
  • 🎨 Custom colors and sizes
  • 🔄 Controlled and uncontrolled usage
  • ♿ Accessible
  • 🎯 TypeScript support
  • ✨ Hover effects

🚀 Quick Start

import { StarRating } from '@gietmanic/react-star-rating';

function App() {
  return (
    <StarRating
      onChange={(rating) => console.log('New rating:', rating)}
      initialRating={3}
      size={32}
      activeColor="#FBBF24"
      inactiveColor="#D1D5DB"
      minStars={1}
      maxStars={10}
      showMinStarsText={true}
      showRatingText={true}
    />
  );
}

Props

PropTypeDefaultDescription
onChange(rating: number) => voidundefinedCallback function called when rating changes
initialRatingnumber0Initial rating value
sizenumber32Size of stars in pixels
activeColorstring'#FBBF24'Color of active (filled) stars
inactiveColorstring'#D1D5DB'Color of inactive stars
minStarsnumber1Minimum number of stars required
maxStarsnumber5Maximum number of stars available
showMinStarsTextbooleantrueShow/hide minimum stars requirement text
showRatingTextbooleantrueShow/hide current rating text

📋 Usage Examples

Basic Usage

<StarRating onChange={(rating) => console.log(rating)} />

Custom Range

<StarRating minStars={2} maxStars={10} />

Custom Colors

<StarRating
  activeColor="#FFD700"
  inactiveColor="#C0C0C0"
/>

Hide Texts

<StarRating
  showMinStarsText={false}
  showRatingText={false}
/>

Full Customization

<StarRating
  onChange={(rating) => console.log('New rating:', rating)}
  initialRating={3}
  size={32}
  activeColor="#FBBF24"
  inactiveColor="#D1D5DB"
  minStars={1}
  maxStars={10}
  showMinStarsText={true}
  showRatingText={true}
/>

📝 License

MIT

🤝 Contributing

Contributions are welcome!

  1. Fork it
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📫 Support

Keywords

FAQs

Package last updated on 09 Nov 2024

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