FloatButton

When To Use#

  • For global functionality on the site.

  • Buttons that can be seen wherever you browse.

Import Module#

import { NzFloatButtonModule } from 'ng-zorro-antd/float-button';

Examples

The most basic usage.

expand codeexpand code
      Loading...
    

Change the shape of the FloatButton with nsShape.

expand codeexpand code
      Loading...
    

When multiple buttons are used together, nz-float-button-group is recommended. By setting nzShape of FloatButtonGroup, you can change the shape of group.

expand codeexpand code
      Loading...
    

Set the nzOpen property to control whether nz-float-button-group is expanded.

expand codeexpand code
      Loading...
    

Change the type of the FloatButton with nzType.

expand codeexpand code
      Loading...
    

Setting nzDescription prop to show FloatButton with description.

supported only when shape is square. Due to narrow space for text, short sentence is recommended.

expand codeexpand code
      Loading...
    

Open menu mode with nzTrigger, which could be hover or click.

expand codeexpand code
      Loading...
    
Scroll down to see the back to top button on the bottom right

Set the nzOpen property to control whether nz-float-button-group is expanded.

expand codeexpand code
      Loading...
    

API#

common API#

PropertyDescriptionTypeDefault
[nzIcon]Set the icon component of buttonTemplateRef<void>-
[nzDescription]Text and otherTemplateRef<void> | string-
[nzType]Setting button typedefault | primarydefault
[nzShape]Setting button shapecircle | squarecircle
[nzHref]The target of hyperlinkstring-
[nzTarget]Specifies where to display the linked URLstring-
(nzOnClick)Set the handler to handle click eventEventEmitter<boolean>-

nz-float-button-group#

PropertyDescriptionTypeDefault
[nzShape]Set button group shapecircle | squarecircle
[nzTrigger]Which action can trigger menu open/closeclick | hover-
[nzOpen]Whether the menu is visible or notboolean-
(nzOnOpenChange)Callback executed when active menu is changedEventEmitter<boolean>-

nz-float-button-top#

PropertyDescriptionTypeDefaultGlobal Config
[nzVisibilityHeight]the nz-float-button-top button will not show until the scroll height reaches this valuenumber400
[nzTarget]specifies the scrollable area dom nodestring | Elementwindow
[nzDuration]Time to return to top (ms)number450
(nzOnClick)a callback function, which can be executed when you click the buttonEventEmitter<boolean>-