Open In App

Angular PrimeNG ProgressSpinner Properties

Improve
Improve
Like Article
Like
Save
Share
Report

Angular PrimeNG is an open-source library that consists of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will be seeing Angular PrimeNG ProgressSpinner Properties.

ProgressSpinner Component is used to notify the user about the progress of a task. The progress spinner can be customized using its properties which are listed below.

Angular PrimeNG ProgressSpinner Properties:

  • strokeWidth: It defines the width of the circle stroke. It takes a string value and the default value is “2”.
  • fill: It is the color of the background of the circle. It takes a string value and the default value is null.
  • animationDuration: The duration in which the circle completes one rotation. It takes a string value and the default value is “2s”.

Syntax:

<p-progressSpinner 
    strokeWidth="..." 
    fill="..." 
    animationDuration="...">
</p-progressSpinner>

Creating Angular Application and Installing the Module:

Step 1: Create an Angular application using the following command.

ng new appname

Step 2: After creating your project folder i.e. appname, move to it using the following command.

cd appname

Step 3: Finally, Install PrimeNG in your given directory.

npm install primeng --save
npm install primeicons --save

Project Structure: The project Structure will look like this after following the above steps:

Project Structure

Run the below command to start the application:

ng serve --open

Example 1: This example illustrates the use of the strokeWidth and the animationDuration properties of the progress spinner.

app.component.html




<h2 style="color: green">GeeksforGeeks</h2>
<h3>Angular PrimeNG ProgressSpinner Properties</h3>
  
<p>Stroke Width: 3 and Animation Duration: 3s</p>
<p-progressSpinner 
    strokeWidth="3"  
    animationDuration="3s">
</p-progressSpinner>
  
<p>Stroke Width: 5 and Animation Duration: 1s</p>
<p-progressSpinner 
    strokeWidth="5"  
    animationDuration="1s">
</p-progressSpinner>


app.component.ts




import { Component } from "@angular/core";
  
@Component({
    selector: "app-root",
    templateUrl: "./app.component.html",
})
  
export class AppComponent {}


app.module.ts




import { NgModule } from "@angular/core";
import { BrowserModule }
    from "@angular/platform-browser";
import { BrowserAnimationsModule }
    from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { ProgressSpinnerModule } 
    from 'primeng/progressspinner';
  
@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        ProgressSpinnerModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent],
})
  
export class AppModule { }


Output:

 

Example 2: This example illustrates the use of the fill property of the progress spinner.

app.component.html




<h2 style="color: green">GeeksforGeeks</h2>
<h3>Angular PrimeNG ProgressSpinner Properties</h3>
  
<p>ProgressSpinner with background filled</p>
<p-progressSpinner 
    strokeWidth="3"  
    fill="rgba(89, 255, 67, 0.647)"
    animationDuration="3s">
</p-progressSpinner>
  
<p-progressSpinner 
    strokeWidth="3"  
    fill="red"
    animationDuration="3s">
</p-progressSpinner>


app.component.ts




import { Component } from "@angular/core";
  
@Component({
    selector: "app-root",
    templateUrl: "./app.component.html",
    styleUrls: ['./app.component.css']
})
  
export class AppComponent {}


app.module.ts




import { NgModule } from "@angular/core";
import { BrowserModule }
    from "@angular/platform-browser";
import { BrowserAnimationsModule }
    from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { ProgressSpinnerModule } 
    from 'primeng/progressspinner';
  
@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        ProgressSpinnerModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent],
})
  
export class AppModule { }


Output:

 

Reference: http://primefaces.org/primeng/progressspinner



Last Updated : 24 Sep, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads