1.2.0 • Published 7 months ago

react-animated-rating v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

react-animated-rating

NPM version Build npm-typescriptLicense]github-license-url

react-animated-rating is an animated rating React component.

Demo

See react-animated-rating in action.

Installation

yarn add react-animated-rating

OR

npm install react-animated-rating

Usage

Add Rating to your component:

import Rating from 'react-animated-rating';

<Rating />

Properties

PropertyTypeDefaultDescription
animationbooleantrueWhether icon animation is enabled or not.
countnumber5Number of icons.
disabledbooleanfalseWhether icon is disabled or not.
fillednumber0Number of filled icons.
iconReactNode-Embed SVG element as a React node.
initialBouncebooleantrue - when disabled is false; false - when disabled is trueWhether bounce animation onload is enabled or not. The default value is determined by the disabled prop.
sizestring"1.5em"Font size of the SVG icon (Default width = 1em and height = 1em. Therefore, if size = 1.5em, then width = 24px and height = 24px). Does not work if the property icon is set. Only works with the default star icon.
wrapperClassNamestring-Wrapper class for the Rating component.

Callbacks

CallbackTypeDescription
onChangefunction (value) {}Returns the rating value when the icon is clicked.

Change Icon Color

The CSS root variable --icon-color depicts the color of the SVG icon.

To change its color, specify the wrapperClassName and override the --icon-color variable as shown below.

JSX

import Rating from 'react-animated-rating';

<Rating wrapperClassName="icon-red" />

CSS

.icon-red { --icon-color: red; }
1.2.0

7 months ago

1.1.0

7 months ago

1.0.6

11 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago