Floating action button


I wanted to try the floating action button <button fab fab-bottom> and don’t understand why during scrolling the button scroll also. I thought that if you ask to stay at the bottom, it will stay there. What am I missing?

I have something like:

  <ion-card *ng-for...>
    <div ...>
    <ion-item actions>

  <button fab fab-bottom fab-right>
    <icon add></icon>


You’ve put the button inside the ion-content – and ion-content is the scrolling part.

Maybe test placing the button outside of the ion-content. Adjust placement in scss as needed.


@mikkokam, you found the solution to my issue! Big thanks!

I was sure that everything needed to be within the ion-content. Really good to know.

1 Like

this didn’t work for me…gonna try the css way…

Do you have something like

<ion-navbar *navbar calm>


<button fab fab-bottom fab-right (click)="add()" calm>
  <ion-icon name="add"></ion-icon>

Had it just like that the button just disappeared from the view. What I did in the css was put


And it did what I wanted


same issue for me, i tried to set position: fixed, it’s better but now my button is behind my ion-content…

Try using z-index and setting it to something like 100 (or higher if needed) for the fixed element.

1 Like

Already try with z-index: 99, still doesn’t work

.button-fab {
  z-index: 100;

did the trick for me.

1 Like

Still ko

this is my code

<ion-content padding> <ion-card> <ion-card-content> <ion-list> <ion-item ion-item *ngFor="#c of cards"> <ion-label id={{c.id}}>{{c.title}}</ion-label> <ion-icon darkgrey name="close" item-center></ion-icon> </ion-item> </ion-list> </ion-card-content> </ion-card> </ion-content> <button fab fab-bottom fab-center class="fixed" (click)="add()"> <ion-icon name="add"></ion-icon> </button>

And my scss

.fixed{ position: fixed; } .button-fab { z-index: 100; }
my fab-bottom button still behind my ion-content.

1 Like

styling inline with z-index works fine.

here is my code:

      <ion-item-sliding *ngFor="#item of items">

<button fab fab-right fab-bottom (click)="" style="z-index:100">
    <ion-icon name="add"></ion-icon>

Issue solved with this syntax ! Thanks

how to make it disappear when scrolls down like it does on a material design?

Btw guys only using the z-index under ion-content works for me. If you try to make a list with ion-sliders the buttons css will become all messed up.

I don’t understand why the position is set to absolute and not fixed.
It’s not logical that the fab scrolls with the screen.

Maybe can someone clarify this choice ?

Personally with the fab inside the ion-content, it scrolls (normal) and when put outside the ion-content, it doesn’t scroll anymore but is behind the content.
Thus in both cases, it needs CSS adjustments. I think a simple position: fixed would resolve this issue, no ?

1 Like

This works for me :smiley:

     <ion-fab right bottom>
         <button ion-fab color="danger"><ion-icon name="add"></ion-icon></button>   

thanks man it’s work for me.

As you wrote. It worked for me! Ionic 4
ion-fab horizontal=“end” vertical=“bottom” style=“position:fixed”

you’ve put the button wrong place .

Try to test placing the button outside of the ion-content.