0.0.2 • Published 8 years ago
counting-stars v0.0.2
Counting Stars
Counting stars like you are One Republic.
Installation
CDN: https://npmcdn.com/counting-stars
npm install counting-stars
Example
// default settings
const options = {
chars = ['★', '☆'],
rating = 0,
tag = 'span',
attrs = {}
};
// usage
import countingStars from 'counting-stars';
countingStars({
rating: 4
});
// use your favorite chars
countingStars({
chars: [
'<i class="fa fa-star"></i>', // full star
'<i class="fa fa-star-o"></i>', // half star
],
rating: 3.5
});
// wrap star with tag and give it attributes
countingStars({
attrs: {
'onClick': 'handleClick'
},
rating: 3.5
});
License
MIT © EGOIST