https://github.com/pirxpilot/rating
Displays stars based on numeric rating (read-only).
https://github.com/pirxpilot/rating
browser
Last synced: 5 months ago
JSON representation
Displays stars based on numeric rating (read-only).
- Host: GitHub
- URL: https://github.com/pirxpilot/rating
- Owner: pirxpilot
- License: mit
- Created: 2013-03-30T20:23:40.000Z (over 13 years ago)
- Default Branch: main
- Last Pushed: 2025-04-27T03:39:48.000Z (about 1 year ago)
- Last Synced: 2025-09-20T14:23:19.219Z (10 months ago)
- Topics: browser
- Language: JavaScript
- Homepage: http://pirxpilot.github.com/rating
- Size: 23.4 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
- License: License.txt
Awesome Lists containing this project
README
[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
# rating
Read-only numeric rating (0-100) displayed as stars.
Click [here](http://pirxpilot.github.com/rating) to see the example.
## Installation
$ npm install ro-rating
## API
### rating(el, value)
Add rating component to `el` and display the `value`
### rating(el, options)
options is an object that allows specifying alternative star character and/or initial value
````javascript
var rating = require('rating');
// use ★ and initial value 25
rating(parent, 25);
// use ❤ and initial value 50
rating(parent, {
value: 50,
star: '❤' // ❤
});
````
### rating.set(value)
Change the `value` of existing rating.
## License
MIT
MIT © [Damian Krzeminski](https://pirxpilot.me)
[npm-image]: https://img.shields.io/npm/v/ro-rating.svg
[npm-url]: https://npmjs.org/package/ro-rating
[travis-url]: https://travis-ci.org/pirxpilot/rating
[travis-image]: https://img.shields.io/travis/pirxpilot/rating.svg