Tutorialsplane

Angular Material Fab Speed Dial


Angular Material Fab Speed Dial:<md-fab-speed-dial> directive is used to create fab speed dial in Angular Material. Speed dial basically represents the series of popup elements which provides the quick access for most common actions/tasks. Here in this tutorial we are going to explain how you can create Fab Speed Dial in Angular Material. You Can also use our online editor to edit and run the code online.


Angular Material Fab Speed Dial Example

Let us first create very basic Fab Speed Dial-

Angular Material Fab Speed Dial Example:

 <md-fab-speed-dial md-direction="up" class="md-fling">
<md-fab-trigger>
          <md-button aria-label="menu" class="md-fab md-warn">
           <i class="material-icons">line_weight</i>
          </md-button>
        </md-fab-trigger>

  <md-fab-actions>
    <md-button class="md-fab" aria-label="Add User">
      <i class="material-icons">account_circle</i>
    </md-button>

    <md-button class="md-fab" aria-label="Add Group">
      <i class="material-icons">group_work</i>
    </md-button>
  </md-fab-actions>
</md-fab-speed-dial>
Try It On →

This is the very basic fab speed dial. If you run the above example it will produce output something like this –

Add Animation to Fab Speed Dial

Two animations(classes) are available for Fab Speed Dial.

Let Us create an example to understand the both animations.

Fab Speed Dial Animation Example

Add animation classes – md-fling, md-scale to the directive md-fab-speed-dial. Here is an example of both animations –

md-fling | md-scale | Animation | Example:

<h3>md-fling Animation Example</h3>
  <md-fab-speed-dial md-direction="up" class="md-fling">
  <md-fab-trigger>
    <md-button aria-label="Add..." class="md-fab md-warn"><i class="material-icons">line_weight</i></md-button>
  </md-fab-trigger>

  <md-fab-actions>
    <md-button aria-label="Add User">
      <i class="material-icons">account_circle</i>
    </md-button>

    <md-button aria-label="Add Group">
      <i class="material-icons">group_work</i>
    </md-button>
  </md-fab-actions>
</md-fab-speed-dial>
<h3>md-scale Example</h3>
  <md-fab-speed-dial md-direction="up" class="md-scale">
  <md-fab-trigger>
    <md-button aria-label="Add..." class="md-fab md-warn"><i class="material-icons">line_weight</i></md-button>
  </md-fab-trigger>

  <md-fab-actions>
    <md-button aria-label="Add User">
      <i class="material-icons">account_circle</i>
    </md-button>

    <md-button aria-label="Add Group">
      <i class="material-icons">group_work</i>
    </md-button>
  </md-fab-actions>
</md-fab-speed-dial>
Try It On →

Add Position Of Trigger

You can easily assign the trigger button position using the inbuilt classes. The following positions are available let us go one by one.

Set Direction

You can set the direction for items(direction in which speed dial appear relative to trigger button) using the attribute md-direction. Following Options are available.

Now let us create an example to understand how these four directions works –

Fab Speed Dial Direction Example:

  <md-fab-speed-dial md-direction="up" class="md-fling">
   ....
  </md-fab-speed-dial>
  <md-fab-speed-dial md-direction="down" class="md-fling">
   ....
  </md-fab-speed-dial>
  <md-fab-speed-dial md-direction="left" class="md-fling">
   ....
  </md-fab-speed-dial>

  <md-fab-speed-dial md-direction="right" class="md-fling">
   ....
  </md-fab-speed-dial>
Try It On →

Learn Angular Material