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

react-star

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-star

A tiny star rating component with custom icons for React.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
increased by62.5%
Maintainers
1
Weekly downloads
 
Created
Source

react-star

⭐️ Please support us by giving a star! Thanks! ⭐️

react-star

A tiny star rating component with custom icons for React.

🎁 Features

  • Easy to use
  • Compatible with both JavaScript and TypeScript

🔧 Install

react-star is available on npm. It can be installed with the following command:

npm install react-star --save

react-star is available on yarn as well. It can be installed with the following command:

yarn add react-star

💡 Usage

import React from 'react';
import { Star } from 'react-star';

class App extends React.Component {
  render() {
    return (
      <Star
        onChange={(value) => console.log(value)}
      />
    );
  }
};

export default App;

📖 APIs

PropsTypeDefaultDescription
defaultValuenumber0The default value. Use when the component is not controlled.
shape'thin' | 'fat''thin'The shape of the star.
fractionnumber1The number of equal subdivisions that can be selected as a rating in each icon, example, for a fractions value of 2, you will be able to select a rating with a precision of down to half a icon.
readOnlybooleanfalseRemoves all hover effects and pointer events.
minnumber0Minimum star.
maxnumber5Maximum star.

🔰 Callbacks

CallbackTypeDescription
onChange(value) => {}The onChange props fires the moment when the value of the element is changed.
onClick(value) => {}The onclick props fires on a mouse click on the element.
onHover(value) => {}The onHover event occurs when the mouse pointer is moved onto an element.

❗ Issues

If you think any of the react-star can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.

🌟 Contribution

We'd love to have your helping hand on contributions to react-star by forking and sending a pull request!

Your contributions are heartily ♡ welcome, recognized and appreciated. (✿◠‿◠)

How to contribute:

  • Open pull request with improvements
  • Discuss ideas in issues
  • Spread the word
  • Reach out with any feedback

⚖️ License

The MIT License License: MIT

Keywords

FAQs

Package last updated on 21 Mar 2021

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