The Alert component for Retool Apps
A message box to display important information with optional title and clickable action.
For more information about this component, refer to the Informational components guide.
Properties
All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.
actionIcon
The icon to display on the action button.
Type | string |
Format | Plain Text |
Configurability | Inspector |
Examples
"/icon:bold/alert"
actionIconPosition
The position of the action icon.
Type | string | ||||||
Format | Plain Text | ||||||
Configurability | Inspector | ||||||
Allowed Values |
|
Examples
"left"
actionPosition
The position of the action button.
Type | string | ||||||
Configurability | Inspector | ||||||
Allowed Values |
|
actionText
The text to display on the action button.
Type | string |
Format | Plain Text |
Configurability | Inspector |
Examples
"Submit"
actionTooltip
The tooltip to display on hover over the action button.
Type | string |
Format | Plain Text |
Configurability | Inspector |
Examples
"Click to deploy."
Examples
"#ff0000"
closeIconPosition
The position of the icon relative to the text.
Type | string | ||||||||||||
Format | Plain Text | ||||||||||||
Configurability | Inspector > Content > Add-ons > Icon position | ||||||||||||
Allowed Values |
| ||||||||||||
Default |
|
Examples
left
events
A list of configured event handlers that trigger actions or queries.
Type | array |
Array values | object |
Configurability | Inspector > Interaction > Event handlers |
Array Object Properties
event
The event that triggers the action. Refer to the events section for details of available events for this object.
Type | string |
Configurability | Inspector > Interaction > Event handlers > Event |
method
The JavaScript method to perform when type
is datasource
, widget
, state
, or localStorage
.
Type | string |
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Run script actions |
type
The type of action to perform.
Type | string | ||||||||||||||
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Action | ||||||||||||||
Allowed Values |
|
hidden
Whether this object is hidden from view.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Hidden |
Default |
|
Examples
true
icon
the icon to display.
Type | string |
Format | Icon Key |
Configurability | Inspector > Content > Add-ons > Icon |
Default |
|
Examples
/icon:bold/shopping-gift
iconPosition
The position of the icon relative to the text.
Type | string | ||||||||||||
Format | Plain Text | ||||||||||||
Configurability | Inspector > Content > Add-ons > Icon position | ||||||||||||
Allowed Values |
| ||||||||||||
Default |
|
Examples
left
Examples
query1
button1
isHiddenOnDesktop
Whether to show or hide this object in the desktop layout.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Show on desktop |
Default |
|
Examples
true
isHiddenOnMobile
Whether to show or hide this object in the mobile layout.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Show on mobile |
Default |
|
Examples
true
maintainSpaceWhenHidden
Whether to take up space on the canvas if hidden
is true
.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Maintain space when hidden |
Default |
|
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Configurability | Inspector > Spacing > Margin | |||||||||
Allowed Values |
| |||||||||
Default |
|
Examples
4px 8px
onActionClick
The event handler that runs when the action is clicked.
Type | string |
Configurability | Read-only |
showInEditor
Whether the component remains visible in the editor if hidden
is true
.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Always show in edit mode |
Default |
|
Examples
true
styleVariant
The style variant to use.
Type | string | ||||||
Format | Plain Text | ||||||
Configurability | Inspector > Appearance > Variant | ||||||
Allowed Values |
| ||||||
Default |
|
Examples
solid
tooltip
The tooltip text to display next to the label on hover.
Type | string |
Format | Markdown |
Configurability | Inspector > Content > Add-ons > Tooltip |
value
The current or default value.
Type | string |
Format | Plain Text |
Configurability | Inspector > Content > Default value |
Default |
|
Examples
Hello world!
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
alert.clearValue()
Examples
Clear the current value of alert
.
alert.clearValue();
alert.resetValue()
Examples
Reset the current value of alert
.
alert.resetValue();
alert.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
alert.scrollIntoView(options)
Parameters
Object Properties
behavior
The scroll behavior.
Type | string | ||||||
Allowed Values |
|
block
The scroll position relative to the component.
Type | string | ||||||||||
Allowed Values |
|
Examples
Scroll the minimum amount to immediately bring alert
into view.
alert.scrollIntoView({behavior: 'auto', block: 'nearest'});
alert.setHidden()
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
alert.setHidden(hidden)
Parameters
Examples
true
Examples
Hide alert
.
alert.setHidden(true);
Unhide alert
.
alert.setHidden(false);
alert.setValue(key, value)
Examples
Set the current value of alert
to userValue
.
alert.setValue(userValue);
Events
Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.
Event | Description |
---|---|
Close | The component or item is closed. |