Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

afrorating

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

afrorating

AfroRating is an Angular star rating library using SVG icons.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

AfroRating

CircleCI NPM Vesion NPM Downloads

AfroRating is an Angular frontend star rating library.

Installing

npm install afrorating

Usage

Component

import { Component } from '@angular/core';
import { AfroRatingComponent } from 'afrorating';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [AfroRatingComponent],
  templateUrl: './app.component.html',
  styleUrl: './app.component.css'
})
export class AppComponent {
  rate = 5;

  onHoverChange(event: MouseEvent) {
    console.log("hoverchanged", event);
  }

  onRateChange(value: number) {
    console.log("ratechanged", value);
  }
}

Template

<div style="width:100%">
    <afrorating [total]="10" [(rate)]="rate" [color]="'#ce0101'" [scaleDown]="10" (rateChange)="onRateChange($event)" (hoverChange)="onHoverChange($event)" [readonly]="false"></afrorating>
</div>

<div style="display:flex;flex-direction:row;width:50%;align-items:stretch;">
        <afrorating [total]="10" [(rate)]="rate" [color]="'green'" [showTooltip]="false" [readonly]="true"></afrorating>
        <div style="text-align:center;width:6vw;font-size:4vw;padding-left:1vw;padding-right:1vw" [style]="rate ? '' : 'visibility:hidden'">
            {{rate}}
        </div>
        <button (click)="rate=0" style="width:10vw;color:white;background-color:green;">Clear</button>
</div>

Input Attributes

NameTypeDefaultDescription
colorstring"green"CSS color value of icons
ratenumber0Current rating value
readonlybooleanfalseWhether or not to make icons interactive
scaleDownnumber0Value to shrink icon size
showTooltipbooleantrueWhether or not to display value on hover
totalnumber5Max value of rating scale

Events

NameTypePayloadDescription
hoverChangefunctionMouseEventFunction to call when hover event changes
rateChangefunctionnumberFunction to call when rating value changes

Keywords

FAQs

Package last updated on 07 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc