Coder Social home page Coder Social logo

trendingtechnology / react-rating Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dreyescat/react-rating

0.0 2.0 0.0 3.73 MB

A rating react component with custom symbols.

Home Page: http://dreyescat.github.io/react-rating/

License: MIT License

HTML 33.53% Shell 3.21% JavaScript 63.26%

react-rating's Introduction

npm version

React Rating

React Rating is a react rating component which supports custom symbols both with inline styles and glyphicons found in popular CSS Toolkits like Fontawesome or Bootstrap.

This React component was inspired by the jQuery plugin bootstrap-rating.

Demo

See react-rating in action.

Installation

You can install react-rating component using the npm package manager:

npm install --save react-rating

Dependencies

The react-rating component peer depends on the React library.

You can install React using npm too:

npm install --save react

Upgrade Warning

If you are using a version of React Rating < v1.0 be aware that there are API changes between anything < v1.0 and v1.0 . See the Properties and Deprecated Properties and Callbacks sections below for a documentation of the current API and how it compares to the old.

Usage

  1. Require the Rating Component

    var Rating = require('react-rating');
  2. Start using it

    With raw javascript:

    React.createElement(Rating)

    Or with JSX:

    <Rating />

Properties

Property Type Default Description
start number 0 Range starting value (exclusive).
stop number 5 Range stop value (inclusive).
step number 1 Describes how many values each Symbol represents. For example, for a start value of 0, a stop value of 10 and a step of 2, we will end up with 5 Symbols, with each Symbol representing value increments of 2.
fractions number 1 Number of equal subdivisions that can be selected as a rating in each Symbol. For example, for a fractions value of 2, you will be able to select a rating with a precision of down to half a Symbol. Must be >= 1
initialRating number 0 The value that will be used as an initial rating. This is the old initialRate.
placeholderRating number 0 If you do not define an initialRating value, you can use a placeholder rating. Visually, this will have the same result as if you had defined an initialRating value. If initialRating is set placeholderRating is not taken into account. This is the old placeholderRate
readonly bool false Whether the rating can be modified or not.
quiet bool false Whether to animate rate hovering or not.
direction ltr or rtl ltr The direction of the rating element contents
emptySymbol element or object or string or array Style.empty React element, inline style object, or classes applied to the rating symbols when empty. Can also be an array of such symbols that will be applied in a circular manner (round-robin). This is the old empty.
fullSymbol element or object or string or array Style.full React element, inline style object, or classes applied to the rating symbols when full. Can also be an array of such symbols that will be applied in a circular manner (round-robin). This is the old full.
placeholderSymbol element or object or string or array Style.placeholder React element, inline style object, or classes applied to the placeholder rating symbols. Can also be an array of such symbols that will be applied in a circular manner (round-robin). This is the old placeholder.

Callbacks

Callback Type Description
onChange function (value) {} Gets called with the value when you click on a different value than the currently set one.
onHover function (value) {} Gets called with the value when you hover over a symbol. The value is equal to the value that corresponds to that part of the symbol. Gets called in quiet mode too. When hover ends, gets called with no value (i.e. undefined as the value).

Deprecated Properties and Callbacks

This is a list of deprecated properties and callbacks from versions older than v1.0

  • onClick
  • onRate
  • initialRate
  • placeholderRate
  • empty
  • full
  • placeholder

License

MIT License

react-rating's People

Contributors

adamredwards avatar andries-smit avatar bslinger avatar darkowic avatar djkwagala avatar dreyescat avatar filipposarzana avatar israelidanny avatar joargp avatar kachkaev avatar kornil avatar masakij avatar mkarajohn avatar nareix avatar thomastorfsixor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.