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 | ||||
Mutability |
|
Examples
"/icon:bold/alert"
actionIconPosition
The position of the action icon.
Type | string | ||||||
Format | Plain Text | ||||||
Mutability |
| ||||||
Allowed Values |
|
Examples
"left"
actionPosition
The position of the action button.
Type | string | ||||||
Mutability |
| ||||||
Allowed Values |
|
actionText
The text to display on the action button.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
|
Examples
"Submit"
actionTooltip
The tooltip to display on hover over the action button.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
|
Examples
"Click to deploy."
backgroundColor
The background color.
Type | string | ||||
Format | Color | ||||
Mutability |
|
Examples
"#ff0000"
closeIconPosition
The position of the icon relative to the text.
Type | string | ||||||||||||
Format | Plain Text | ||||||||||||
Mutability |
| ||||||||||||
Allowed Values |
| ||||||||||||
Default |
|
Examples
left
description
Descriptive text to display to the user.
Type | string | ||||
Mutability |
|
hidden
Whether this object is hidden from view.
Type | boolean | ||||||
Format | True/False | ||||||
Mutability |
| ||||||
Default |
|
Examples
true
icon
the icon to display.
Type | string | ||||
Format | Icon Key | ||||
Mutability |
| ||||
Default |
|
Examples
/icon:bold/shopping-gift
iconPosition
The position of the icon relative to the text.
Type | string | ||||||||||||
Format | Plain Text | ||||||||||||
Mutability |
| ||||||||||||
Allowed Values |
| ||||||||||||
Default |
|
Examples
left
id
The unique identifier (name).
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
query1
button1
isHiddenOnDesktop
Whether to show or hide this object in the desktop layout.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
isHiddenOnMobile
Whether to show or hide this object in the mobile layout.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
maintainSpaceWhenHidden
Whether to take up space on the canvas if hidden
is true
.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Mutability |
| |||||||||
Allowed Values |
| |||||||||
Default |
|
Examples
4px 8px
onActionClick
The event handler that runs when the action is clicked.
Type | string |
Mutability | Read-only |
showInEditor
Whether the component remains visible in the editor if hidden
is true
.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
style
Custom style options.
Type | object | ||||
Mutability |
|
styleVariant
The style variant to use.
Type | string | ||||||
Format | Plain Text | ||||||
Mutability |
| ||||||
Allowed Values |
| ||||||
Default |
|
Examples
solid
tooltip
The tooltip text to display next to the label on hover.
Type | string | ||||
Format | Markdown | ||||
Mutability |
|
value
The current or default value.
Type | string | ||||||
Format | Plain Text | ||||||
Mutability |
| ||||||
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(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. |