1.1.5 • Published 6 months ago

react-easy-star-rating v1.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

React Simple Star Rating ⭐️

Image

Compatible with React 18+
A customizable and lightweight star rating component for React. Perfect for implementing rating systems in your applications with ease. Supports fractional ratings like 3.4 for precise and detailed feedback!

Features 🚀

  • Customizable: Modify the number of stars, colors, size, and more.
  • Lightweight: Built with performance and simplicity in mind.
  • Interactive: Supports click events for user interaction.
  • TypeScript Support: Fully typed for seamless integration.

Installation 📦

To install the package, run the following command:

npm install react-easy-star-rating

yarn add react-easy-star-rating

pnpm add react-easy-star-rating

Usage 💡

Here's a basic example:

import React from "react";
import StarRating from "react-easy-star-rating";

function App() {
  return <StarRating variant={"fill"} maxStars={5} currentScore={3} size={30} onClick={(rating) => console.log(`Rated: ${rating}`)} />;
}

export default App;

Props 🛠️

NameTypeDefaultDescription
variant"fill", "outline-fill""fill"Variant of the stars
maxStarsnumber5Maximum number of stars.
currentScorenumber0Initial rating value (can be updated dynamically).
sizenumber24Size of each star in pixels.
sizenumber24Size of each star in pixels.
emptyOutlineColorstring"#D2D2D2"outline color
emptyOutlineFillColorstringoutline filled stars color.
starEmptyColorstring"#D2D2D2"Color of the empty stars.
starFillColorstring"#FF501B"Color of the filled stars.
onClick(currentStar: number) => voidundefinedCallback function triggered when a star is clicked.
isClickablebooleantrueDetermines if the stars are clickable.
containerStyleCSSProperties{}Custom styles for the container wrapping the stars.
starStyleCSSProperties{}Custom styles for each star.
1.1.5

6 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.0

6 months ago