2.0.3 • Published 4 years ago

front10-rating v2.0.3

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

front10-rating is a simple and tiny Rating React Component

Installation

npm install front10-rating

or

yarn add front10-rating

Examples

Basic

import React from 'react';
import Rating from 'front10-rating';

const App = () => {
  return <Rating value={4.5} />;
};

Basic example

Custom render

import React from 'react';
import Rating from 'front10-rating';
import apple from './apple.png';
import appleEmpty from './apple-empty.png';

const App = () => {
  return (
    <Rating
      value={4}
      renderFullItem={({ index }) => <img key={index} src={apple} />}
      renderEmptyItem={({ index }) => <img key={index} src={appleEmpty} />}
    />
  );
};

Custom render

With some styles

import React from 'react';
import Rating from 'front10-rating';

const App = () => {
  return (
    <Rating
      value={3.5}
      width="60"
      height="60"
      color="indigo"
      emptyColor="yellow"
    />
  );
};

With some styles

List of props

PropertyTypeDefaultDescription
allowRateboolfalseAllow to rate
showValueboolfalseDefine if show the value
starsLengthnumber5Total of items to show
valuenumber0Rating value
widthstring'16'width of the icon
heightstring'16'height of the icon
colorstring'#ffc107'color of the icon
emptyColorstring'#eceff1'color of the empty icon
renderItemfunctionnullFunction to render the Items
renderFullItemfunctionnullFunction to render the marked items
renderEmptyItemfunctionnullFunction to render the unmarked Items
renderHalfItemfunctionnullFunction to render the half items
onClickfunctionnullFunction to handle rate on click
classNamestring''className applied to the component
styleobjectnullinline styles applied to the component
2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago