Skip to main content

Alert

Ant Design

The Alert component shows a colored message box for feedback such as a success notice, a warning or an error. Users can close it when Closable is on, and it can carry one action button.

Properties​

Property
Description
Expected Value
MessageTitle line of the alert. When it is empty, Description is shown as the title instead.Text. Default: A new version is available.
DescriptionLonger text shown under Message.Text
TypeColor and icon of the alert. custom uses custom background, text and border colors, set in the Custom alert section.Info, Success, Warning, Error, Custom. Default: Info
Show iconShows the type icon at the start of the alert.On or off. Default: On
ClosableShows a close button that dismisses the alert.On or off. Default: Off
BannerShows the alert as a full-width strip with no rounded border, for a notice at the top of a page.On or off. Default: Off
Action textText of a small button at the right of the alert. Leave it empty for no button.Text

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off
Dynamic heightLets the component grow with its content in the running app instead of keeping a fixed height.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On closeTriggers when the alert is dismissed, by its close button or the Dismiss action.
On action clickedTriggers when the user clicks the action button set by Action text.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
ShowShows the alert again after it was dismissed.components.alert1.show()
DismissHides the alert and fires its On close event. Nothing happens if it is already hidden.components.alert1.dismiss()
Set visibilityShows the component when true, hides it when false.components.alert1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.alert1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.alert1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
messageTitle line of the alert. When it is empty, Description is shown as the title instead.{{components.alert1.message}}
descriptionLonger text shown under Message.{{components.alert1.description}}
typeColor and icon of the alert. custom uses custom background, text and border colors, set in the Custom alert section.{{components.alert1.type}}
showIconShows the type icon at the start of the alert.{{components.alert1.showIcon}}
closableShows a close button that dismisses the alert.{{components.alert1.closable}}
bannerShows the alert as a full-width strip with no rounded border, for a notice at the top of a page.{{components.alert1.banner}}
actionTextText of a small button at the right of the alert. Leave it empty for no button.{{components.alert1.actionText}}
dismissedtrue while the alert is dismissed and hidden.{{components.alert1.dismissed}}
isVisibleWhether the component is visible.{{components.alert1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.alert1.isLoading}}
isDisabledWhether the component is disabled.{{components.alert1.isDisabled}}

Styles​

Style
Default
Primary colorTheme: Brand primary
Text colorTheme: Primary text
Container backgroundTheme: Surface 1
Border colorTheme: Default border
Border radius—
BackgroundTheme: Surface 1
Text and icon colorTheme: Primary text
Border colorTheme: Default border
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.