Alert

Alert component for feedback.
Import

When To Use#

  • When you need to show alert messages to users.
  • When you need a persistent static container which is closable by user actions.

Examples#

Success Text

The simplest usage for short messages.

      Loading...
    
Warning Text Warning Text Warning Text Warning Text Warning Text Warning Text Warning Text
Error TextError Description Error Description Error Description Error Description Error Description Error Description

To show close button.

      Loading...
    
Success Tips
Informational Notes
Warning
Error
Success TipsDetailed description and advices about successful copywriting.
Informational NotesAdditional description and informations about copywriting.
WarningThis is a warning notice about copywriting.
ErrorThis is an error message about copywriting.

Decent icon make information more clear and more friendly.

      Loading...
    

Display Alert as a banner at top of page.

      Loading...
    
S
Success TipsDetailed description and advices about successful copywriting.

Make information more clear and more friendly and meet customized needs.

      Loading...
    
Success Text
Info Text
Warning Text
Error Text

There are 4 types of Alert: success, info, warning, error.

      Loading...
    
Success TextSuccess Description Success Description Success Description
Info TextInfo Description Info Description Info Description Info Description
Warning TextWarning Description Warning Description Warning Description Warning Description
Error TextError Description Error Description Error Description Error Description

Additional description for alert message.

      Loading...
    
Info Text

Replace the default icon with customized content.

      Loading...
    
Success Text

Error Text

Error Description Error Description Error Description Error Description


Warning Text

Info Text

Info Description Info Description Info Description Info Description

Custom action.

      Loading...
    
I can be a long text that scrolls continuously in the banner alert. This text will loop seamlessly.

Hover over me to pause the scrolling animation. This text loops continuously.

Pass nz-alert-marquee as the [nzMessage] template content of a nzBanner alert to create a scrolling loop banner. Use nzPauseOnHover to pause the animation on mouse hover, and nzSpeed to control the scrolling speed in pixels per second (default 50, higher value = faster scrolling).

      Loading...
    
21.2.0

API#

nz-alert#

PropertyDescriptionTypeDefaultGlobal Config
[nzBanner]Whether to show as bannerbooleanfalse
[nzAction]Customized alert's actionstring | TemplateRef<void>-
[nzCloseable]Whether Alert can be closedboolean-
[nzCloseText]Close text to showstring | TemplateRef<void>-
[nzDescription]Additional content of Alertstring | TemplateRef<void>-
[nzMessage]Content of Alertstring | TemplateRef<void>-
[nzShowIcon]Whether to show icon, in nzBanner mode default is truebooleanfalse
[nzIconType]Icon type, effective when nzShowIcon is truestring-
[nzType]Type of Alert styles, in nzBanner mode default is 'warning''success' | 'info' | 'warning' | 'error''info'
[nzIcon]Custom icon, effective when showIcon is truestring | TemplateRef<void>-
(nzOnClose)Callback when Alert is closedEventEmitter<void>-

nz-alert-marquee#

Use nz-alert-marquee as the [nzMessage] template content to create a scrolling loop banner inside an alert.

PropertyDescriptionTypeDefault
[nzPauseOnHover]Whether to pause the scrolling animation on mouse hoverbooleanfalse
[nzSpeed]Animation speed in pixels per second (higher = faster scrolling)number50