Open In App

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

Improve
Improve
Like Article
Like
Save
Share
Report

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:

  • style: It is the inline style of the element. It is of object data type, the default value is null.
  • direction: It specifies the opening direction of actions. It is of string data type, the default value is up.
  • type: It specifies the opening type of actions. It is of string data type, the default value is linear.
  • model: It is the MenuModel instance to define the action items. It is of object data type, the default value is null.
  • transitionDelay: It is the transition delay step for each action item, It is of number data type, and the default value is 30.
  • buttonClassName: It is the style class of the button element. It is of string data type, the default value is null.
  • showIcon: It is the show icon of the button element. It is of string data type, the default value is pi pi-plus.
  • hideIcon: It is the Hide icon of the button element. It is of string data type, the default value is null.

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.

  • app.component.html:

HTML




<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>


  • app.component.ts:

Javascript




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"
                },
            }
        ];
    }    
}


  • app.module.ts:

Javascript




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”.

  • app.component.html:

HTML




<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>


  • app.component.ts:

Javascript




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"
                },
            }
        ];
    }    
}


  • app.module.ts:

Javascript




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



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