ash-star-ratting
v1.0.4
Published
A reusable React star rating input component
Maintainers
Readme
⭐ ash-star-ratting
A lightweight and reusable React star rating input component.
Built with React and lucide-react, this component allows users to easily provide star-based ratings in your app.
📦 Installation
Install via npm:
npm install ash-star-ratting lucide-react
Note: You must have react and react-dom already installed (they are peer dependencies).
🚀 Usage
1. Import the Component
import StarRating from 'ash-star-ratting';
2. Use it in Your Component
import React, { useState } from 'react';
import StarRating from 'ash-star-ratting';
const App = () => {
const [rating, setRating] = useState(0);
return (
<div>
<h1>Rate this course</h1>
<StarRating
defaultValue={rating}
onChange={(value) => setRating(value)}
/>
<p>Your rating: {rating}</p>
</div>
);
};
export default App;
⚙️ Props
Prop Type Default Description
onChange function null Callback that receives selected star (1–5)
defaultValue number 0 Initial star value (useful for editing)
🎨 Styling
This package uses lucide-react icons with Tailwind-style sizing (e.g., w-6 h-6). You can override styles using a wrapper or CSS utility classes.
🔌 Dependencies
react (peer)
react-dom (peer)
lucide-react
🛠️ Roadmap
Add custom star count (e.g., 10 stars)
Add half-star support
Add color customization
Add read-only mode
TypeScript support
📄 License
MIT © Ashikur Rahman