# 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".

![](https://648587291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FntHgSpSJ3tixDsCMhK2u%2Fuploads%2FsaLnEiC6gS8A7LsGWUC9%2Fimage.png?alt=media\&token=b3d0bebc-9fb5-45c2-a06e-7bf87e5f6682)

### 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](https://docs.criticalmoments.io/events/built-in-events#modal-actions) for details.
