stars-rating-react-hooks
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -1,3 +0,61 @@ | ||
# Stars rating react hooks | ||
# stars-rating-react-hooks ⭐️ | ||
<img width="265" alt="stars-rating-react-hooks" src="https://user-images.githubusercontent.com/27046938/111029678-f390b180-8423-11eb-9497-e8ab2e797686.png"> | ||
## Customizable Star rating component | ||
### Customizable react component for rating stars | ||
- Define `config` object | ||
- import { StarsRating } from "stars-rating-react-hooks" | ||
- Start using `<StarsRating config={config} />` | ||
*** | ||
[![NPM](https://img.shields.io/npm/v/stars-rating-react-hooks.svg)](https://www.npmjs.com/package/stars-rating-react-hooks) | ||
## Install | ||
```bash | ||
npm install --save stars-rating-react-hooks | ||
``` | ||
## Usage (Basic) | ||
<img width="319" alt="stars-rating-react-hooks" src="https://user-images.githubusercontent.com/27046938/111029635-bd533200-8423-11eb-9160-6acc095ec140.png"> | ||
```jsx | ||
import React from 'react' | ||
import { StarsRating } from "stars-rating-react-hooks"; | ||
function Example() { | ||
const config = { | ||
number: 5, | ||
value: 4.5, | ||
renderFull: ( | ||
<img src="https://img.icons8.com/ios-filled/50/000000/star--v1.png" /> | ||
), | ||
renderEmpty: ( | ||
<img src="https://img.icons8.com/ios/50/000000/star--v1.png" /> | ||
), | ||
renderHalf: ( | ||
<img src="https://img.icons8.com/ios-filled/50/000000/star-half-empty.png" /> | ||
) | ||
}; | ||
return <StarsRating config={config} /> | ||
} | ||
export default Example | ||
``` | ||
More info on [prop getters](https://kentcdodds.com/blog/how-to-give-rendering-control-to-users-with-prop-getters) | ||
## Demo | ||
[Basic demo](https://codesandbox.io/s/stars-rating-react-hooks-c936v?file=/src/App.js) | ||
## License | ||
MIT © [07harish](https://github.com/07harish) |
52672
62