> For the complete documentation index, see [llms.txt](https://docs.thunkable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thunkable.com/~/changes/wHhkjLVeheBnfbpghRnw/alert.md).

# Alert

Alerts are useful components for displaying important messages while users are in the app itself

![Demonstration of how an Alert looks on Android, iOS and Web](/files/-MJWGJlS9cXYJXmWp7RD)

## Adding an Alert to your app

To add an Alert component to your app:

* Go to your Blocks tab
* Click the ⊕ icon next to the `Alerts` drawer

![](/files/-MMGueaF0bVFlsbUoASr)

You will see a dialog with options to enter certain properties for your Alert component. Click Submit to create the Alert component, or Delete to dismiss the dialog without creating the component.

![](/files/-MJWZsozvb9GL1oG0ZHp)

### Change properties of your Alert

Once you have added at least one Web API component to your app, you will be able to view all of your Alert components under the `Alerts` drawer on the Blocks tab.&#x20;

![](/files/-MMGum3ja8T6b4tb7FoJ)

To edit the properties of an Alert component, click on the ⚙ icon next to the component's name to bring up the properties dialog. You will be able to change the properties and click Submit to save your changes, or click Delete to delete the component.

## One Button Alert

A one button alert, also known as a notification, displays a message and one button to confirm user has viewed the message

![](/files/-LFy3UPrgcw29UiLCW_x)

To set up an alert, simply fill in the following `simple` properties. The Cancel Button Text only needs to be filled out for a two-button alert. You can use blocks to start an event when

| Property            | Description               |
| ------------------- | ------------------------- |
| Title               | The title of the alert    |
| Message             | The subtitle of the alert |
| Confirm Button Text | The text of the button    |
| Cancel Button Text  | `LEAVE BLANK`             |

## Two button alert

Two button alerts have two buttons, one that dismisses the notification and one that can be programmed to start an event

To set one up, simply add the following `simple` properties

![](/files/-LFy79VAEK7RLxROQAjk)

| Property            | Description                                                                                                   |
| ------------------- | ------------------------------------------------------------------------------------------------------------- |
| Title               | The title of the alert                                                                                        |
| Message             | The subtitle of the alert                                                                                     |
| Confirm Button Text | The text of the right confirm button; If the `danger` switch is turned on, the text will be in red (iOS only) |
| Cancel Button Text  | The text of the left cancel button                                                                            |

## Blocks

If you want to start an event from a confirm button, you will want to add the blocks below:

![](/files/1I0C9IfUBrqeLyYApkY7)

## Button List: Alert with three or more buttons

It is possible to add buttons to an alert for more sophisticated use cases.\
This can be done using the `set Button List to` block by creating a [list](/~/changes/wHhkjLVeheBnfbpghRnw/lists.md) of [objects](/~/changes/wHhkjLVeheBnfbpghRnw/objects.md).

You can set the **Text** of the Alert. You can set the **Style** of the Alert to **ok, destructive** or **cancel.**

On iOS, the Alert can show more than 3 Buttons.\
On Android, the Alert can show up to 3 buttons. If more than 3 buttons are specified, the first 3 will be shown.

![](/files/YlBfxdJRJq1FG24872F3)

![A three button alert displayed on Android and iOS devices](/files/-LFyI_oR57U0HKgtulVS)

| Property         | Description                                                                                                                                      |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Title            | The title of the alert                                                                                                                           |
| Message          | The subtitle of the alert                                                                                                                        |
| Text `Advanced`  | The text of the button                                                                                                                           |
| Style `Advanced` | The style of the button; `ok` is a confirm button, `cancel` is a cancel button and `destructive` is a confirm button with text in red (iOS only) |

The 'showButtonList' block will return an output called 'buttonPressed'.\
This will return the position of the Button in your Button List.\
You can take some action based on which button was pressed.

![](/files/1is3rnu5yfSi6xXA0Vyc)

Note: the Buttons may appear in a different order when testing the app on a device. \
The number that ‘buttonPressed’ returns is the order that the Buttons are added in the app project.
