Socket
Socket
Sign inDemoInstall

react-star-picker

Package Overview
Dependencies
9
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-star-picker

A star-rating component made with React


Version published
Weekly downloads
486
increased by3.62%
Maintainers
1
Install size
44.6 kB
Created
Weekly downloads
 

Readme

Source

react-star-picker

A highly customizable star-rating component

npm version npm license

Default features include

  • supports half-star precision
  • responsive hover highlighting
  • custom number of stars
  • value clearing option
  • input disabling

Read more in the docs.

Support for custom star-renderer

Even more customizability is provided by the ability to use your own star-renderer. Read more here.

Documentation

Installation

npm i react-star-picker

Usage

Note To make this library SSR compatible, versions starting from 3.0.0 export an ES module instead of the previously exported UMD bundle. The major difference is that styles are no longer bundled with the component code and need to be imported separately from react-star-picker/styles.css.

import React, { useState } from 'react';
import StarPicker from 'react-star-picker';
// vvv Starting from v3.0.0 we need to import the styles separately. This is best done in a wrapper component.
import 'react-star-picker/styles.css';
// ^^^

const ParentComponent = () => {
  const [rating, setRating] = useState(null);

  const onChange = (value) => {
    setRating(value);
  };

  return (
    <div>
      <StarPicker onChange={onChange} value={rating} />
    </div>
  );
};

Props

Configuration

Styles

Examples

Component APIs

Keywords

FAQs

Last updated on 29 Mar 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc