react-star-picker
A highly customizable star-rating component
Default features include
Support for custom star-renderer
Even more customizability is provided by the ability to use your own star-renderer. See example in styleguide.
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';
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>
);
};
Styleguide
Props
Configuration
Styles
Examples
Component APIs