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

react-custom-ratings

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-custom-ratings

**react-custom-ratings** react-custom-ratings is a react rating component which supports custom icons and styles and also provides progress bar which shows detailed information on ratings.

  • 0.1.76
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

react-custom-ratings
react-custom-ratings is a react rating component which supports custom icons and styles and also provides progress bar which shows detailed information on ratings.

Installation

npm install react-custom-ratings

Demo

https://codesandbox.io/s/interesting-knuth-rjg53s?file=/src/App.js

alt text

Usage

import {Ratings, Rating, ProgressBar} from 'react-custom-ratings'

const Demo=()=>{
  return(
    <!--  Use Ratings component to display both ratings and progress bar -->
   <Ratings data={[{count:10,rating:5},{count:13,rating:4},{count:10,rating:3},{count:8,rating:2},{count:4,rating:1}]}/>
    <!--    Use Rating component to display ratings   -->
   <Rating  data={[{count:10,rating:5},{count:13,rating:4},{count:10,rating:3},{count:8,rating:2},{count:4,rating:1}]}/>
    <!--   Use ProgresBar component to display ProgressBar    -->
   <ProgressBar  data={[{count:10,rating:5},{count:13,rating:4},{count:10,rating:3},{count:8,rating:2},{count:4,rating:1}]}/>
  )};

API

This a list of props that you can pass down to the Ratings component:

PropertyDescriptionDefault ValueType
dataData for RatingsNAarray
optionsProps applied to the Rating and ProgressBar elements.{ratings:{},progressBar:{}}object

List of props that you can pass down to the Rating Component:

PropertyDescriptionDefault ValueType
showIf it is true the rating component is visibletrueboolean
filledColorFilled rating icon color'#ffa41c'string
unfilledColorEmpty rating icon color'#ffa41c'string
ratingIconClassnameClassname for rating Icon'star'string
classNameclassname for rating header text'rating'string
FilledRatingIconCustom react element for filled rating icon from react-iconsReact element
UnfilledRatingIconCustom react element for unfilled rating icon from react-iconsReact element
headerTextheaderText is function which takes 'percent' type of number as parameter and returns react elementNA(percent: number) => React.ReactElement;

List of props that you can pass down to the ProgressBar Component:

PropertyDescriptionDefault ValueType
filledColorFilled start rating color'#ffa41c'string
unfilledColorEmpty star rating color'#ffa41c'string
classNameclassname for rating header text'rating'string
progressBarTextTo display custom text on left side of progress bar use progressBarText function.progressBarText takes function with parameter 'data' which should return react element(data) => React.ReactElement;React Element
percentageTo display custom percentage of ratings on rigt side of progress bar use percentage function.perecentage takes fucntion with two parameters 'data and 'percent' which should return react element(percent: number, data) => React.ReactElement;React Element
onClickonClick is event handler function which gets executed when clicked on any of the progress bar,first parameter for onClick function is data of the progress bar clicked on.(data) => void;Function

Help improve the component
Build on your machine: Clone the repo git clone https://github.com/Roxiler/react-ratings.git

Install dependancies
npm install

FAQs

Package last updated on 21 Jul 2022

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