# Modal Buttons

Modals have an optional stack of buttons on the bottom of the page. They are sticky, and the content (sections) will scroll under the top button if too tall.&#x20;

Buttons are not required.

### Button Actions

By default all buttons dismiss the modal, and only dismiss the modal.&#x20;

To add another action, you can specify an `actionName` which can fire any other CriticalMoments action, including a deep link to trigger native code in your app.&#x20;

To prevent a button from dismissing the modal when tapped set the `preventDefault` option on the config.

{% hint style="warning" %}
If no buttons are included, or all have `preventDefault` set, be careful not to set `showCloseButton=false` on the modal or the user won't be able to dismiss the modal!
{% endhint %}

### Button Parameters

* `title` \[string, required]: The title of the button
* `style` \[string, optional]: One of styles described [below](#button-styles). If omitted, defaults to `normal`.
* `actionName` \[string, optional]: If specified, the action by this name will be triggered when this button is tapped. Can be used to make the&#x20;
* `preventDefault` \[bool, optional, default false]: prevents the button's default action. In the case of modals, this prevents the modal from being dismissed. ActionName is not impacted by this parameter.

### Button Styles

The following styles are available. The color is derived from the `primaryColor` of the theme for this content (in this case, systemPurple).

Valid values are: "large", "normal", "secondary", "tertiary", "info", "info-small".

![](/files/Jicz5R32KHizg9Z9pema)

### Sample Config

Here is a sample config for a style=secondary button which launches a web link action, and does not dismiss the modal when tapped.

```json
{
    "title": "More info",
    "preventDefault": true,
    "style": "secondary",
    "actionName": "web_link_action"
}
```

### Automatic Button Events

Button taps are tracked as events by default. See [Modal Built-In Events](/events/built-in-events.md#modal-actions) for details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.criticalmoments.io/actions-in-app-messaging/modals/modal-buttons.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
