ion-rating-stars
Version:
Ionic 7/8 rating stars component using Angular
127 lines (93 loc) ⢠3.65 kB
Markdown
<h1 align="center">ion-rating-stars</h1>
<p>
<img src="https://img.shields.io/badge/version-0.0.1-blue.svg?cacheSeconds=2592000" />
<a href="https://github.com/saqib92/ion-rating-stars#readme">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" target="_blank" />
</a>
<a href="https://github.com/saqib92/ion-rating/graphs/commit-activity">
<img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" target="_blank" />
</a>
<a href="https://github.com/saqib92/ion-rating/blob/master/LICENSE">
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" target="_blank" />
</a>
</p>
- [Prerequisites](
- [Install](
- [Setup](
- [Usage](
- [Author](
- [Contributing](
- [Show your support](
- [License](
The current version of the library is compatible with Ionic 7+.
Using npm
```sh
npm install ion-rating-stars --save
```
Using yarn
```sh
yarn add ion-rating-stars
```
For version < 1.3.x (ngModule)
Once installed you need to import our module in the parent module for the component you will be using it in:
```js
import { IonRatingStarsModule } from 'ion-rating-stars';
@NgModule({
...
imports: [IonRatingStarsModule, ...],
...
})
export class YourModule {
}
```
For version > 1.3.x (standalone components)
Once installed you need to import it directly in component, you will be using it in:
```js
import { IonRatingStarsComponent } from 'ion-rating-stars';
@Component({
...
imports: [IonRatingStarsComponent, ...],
...
})
```
Include the component on page template, like the example below:
```
<ion-rating-stars
[]="3"
[]="'darkgrey'"
[]="'orange'"
[]="2"
[]="20"
[]="false"
[]="0.5"
[]="true"
(ratingChange)="ratingChanged($event)"></ion-rating-stars>
```
- rating: `number` [0-5].
- color: `string` color of stars. applies as `color` default `darkgrey`.
- filledColor: `string` filledColor of stars. applies as `color` default `orange`.
- margin: `number` space between stars in pixels. applies as `margin-right`. default `20`.
- size: `number` size of stars. applies as `font-size`. default `20`.
- disabled: `boolean` disables the events and anything on ratings. applies as `pointer-events`. default `false`.
- opacity: `number` change stars opacity when disabled is true. applies as `number` default `0.5`
- isHalfStar: `boolean` to Enable/Disable half stars. applies as `boolean` default `false`
- ratingChange: `EventEmitter<number>, called whenever you change a rating value`
š¤ **Najam Us Saqib**
- Github: [@saqib92](https://github.com/saqib92)
Contributions, issues and feature requests are welcome!<br />
Feel free to check [issues page](https://github.com/saqib92/ion-rating-stars/issues).
Give a āļø if this project helped you!
Copyright Ā© 2023 [Saqb92](https://github.com/saqib92).<br />
This project is [MIT](https://github.com/saqib92/ion-rating-stars/blob/master/LICENSE) licensed.