Open In App

Angular PrimeNG Speed Dial Transition Duration, Icon and No Rotate Animation

Angular PrimeNG is an open-source framework with a rich set 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 learn how to use the SpeedDial Transition Duration, Icon and No Rotate Animation Component in Angular PrimeNG. We will also learn about the properties, along with their syntaxes that will be used in the code.

The SpeedDial Component is used to display many primary actions that can be done using the floating button action while pressing the button.



Syntax:

<p-speedDial
    [model]="..."
    type="..."
    direction="..."
    [transitionDelay]="..."
    showIcon="..."
    hideIcon="..."
    buttonClassName="..."
>
</p-speedDial>

 



Angular PrimeNG Speed Dial Transition Duration, Icon, and No Rotate Animation properties:

Creating Angular application & module installation:

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: Install PrimeNG in your given directory.

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

Project Structure: It will look like the following:

 

Steps to run the application: Run the below command to see the output:

ng serve --open

Example 1: Below is the example that illustrates the use of the Angular PrimeNG Speed Dial Transition Duration, Icon, and No Rotate Animation.




<h1 style="color: green">GeeksforGeeks</h1>
<h5>
    Angular PrimeNG Transition Duration, 
      Icon and No Rotate Animation
</h5>
  
<div style="height: 500px; position: relative;" 
    class="speeddial-delay-demo">
    <p-speedDial
        [model]="gfg"
        direction="down"
        [transitionDelay]="120"
        showIcon="pi pi-arrow-up-right"
        hideIcon="pi pi-times"
        buttonClassName="p-button-filled">
    </p-speedDial>
</div>




import {Component, OnInit} from '@angular/core';
import { MenuItem, MessageService } from 'primeng/api';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss'],
    providers: [MessageService]
})
  
export class AppComponent { 
    gfg: MenuItem[];
  
    constructor(private messageService: MessageService) { }
  
    ngOnInit() {
        this.gfg = [
            {
                icon: 'pi pi-linkedin',
                tooltipOptions: {
                     tooltipLabel: "LinkedIn"
                },
            },
            {
                icon: 'pi pi-slack',
                tooltipOptions: {
                     tooltipLabel: "Slack"
                },
            },
            {
                icon: 'pi pi-whatsapp',
                tooltipOptions: {
                     tooltipLabel: "Whatsapp"
                },
            }
        ];
    }    
}




import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {RouterModule} from '@angular/router';
import { BrowserAnimationsModule } 
    from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import {ProgressSpinnerModule} from 'primeng/progressspinner';
import {RippleModule} from 'primeng/ripple';
import { ToastModule } from 'primeng/toast';
import { SpeedDialModule } from 'primeng/speeddial';
  
@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        ProgressSpinnerModule,
        SpeedDialModule,
        ToastModule,
        RippleModule,
        RouterModule.forRoot([
            {path:'',component: AppComponent},
        ])
    ],
    declarations: [ AppComponent ],
    bootstrap:    [ AppComponent ]
})
  
export class AppModule { }

Output:

 

Example 2: Below is another example that illustrates the use of the Angular PrimeNG Speed Dial Transition Duration, Icon, and No Rotate Animation Component using type=”semi-circle”.




<h1 style="color: green">GeeksforGeeks</h1>
<h5>
    Angular PrimeNG Transition Duration, 
      Icon and No Rotate Animation
</h5>
  
<div style="margin: 50px; height: 300px; position: relative;"
    class="speeddial-delay-demo">
    <p-speedDial
        [model]="gfg"
        type="semi-circle"
        direction="right"
        [transitionDelay]="120"
        showIcon="pi pi-arrow-up-right"
        hideIcon="pi pi-times"
        buttonClassName="p-button-filled">
    </p-speedDial>
</div>




import {Component, OnInit} from '@angular/core';
import { MenuItem, MessageService } from 'primeng/api';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss'],
    providers: [MessageService]
})
  
export class AppComponent { 
    gfg: MenuItem[];
  
    constructor(private messageService: MessageService) { }
  
    ngOnInit() {
        this.gfg = [
            {
                icon: 'pi pi-linkedin',
                tooltipOptions: {
                     tooltipLabel: "LinkedIn"
                },
            },
            {
                icon: 'pi pi-slack',
                tooltipOptions: {
                     tooltipLabel: "Slack"
                },
            },
            {
                icon: 'pi pi-whatsapp',
                tooltipOptions: {
                     tooltipLabel: "Whatsapp"
                },
            }
        ];
    }    
}




import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {RouterModule} from '@angular/router';
import { BrowserAnimationsModule } 
    from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import {ProgressSpinnerModule} from 'primeng/progressspinner';
import {RippleModule} from 'primeng/ripple';
import { ToastModule } from 'primeng/toast';
import { SpeedDialModule } from 'primeng/speeddial';
  
@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        ProgressSpinnerModule,
        SpeedDialModule,
        ToastModule,
        RippleModule,
        RouterModule.forRoot([
            {path:'',component: AppComponent},
        ])
    ],
    declarations: [ AppComponent ],
    bootstrap:    [ AppComponent ]
})
  
export class AppModule { }

Output:

 

Reference: https://primefaces.org/primeng/speeddial


Article Tags :