Critical Moments Docs
Quick StartHomepageAccount
  • Documentation Home
  • What is Critical Moments?
  • Quick Start
  • Concepts Overview
  • Remote Control / Service
    • Host Config on Github Pages
  • Config File Structure
  • Demo App
  • Homepage & Account
  • 📚Guides
    • Mobile App Toolbox: 13 Features Most Apps Need
    • Reduce App Churn with Notifications
    • Improve your App Store Rating
    • Feature Flags Guide
  • ⏰Notifications
    • Intro to Notifications
    • Notifications Spec
    • Smart Delivery
    • Badges
  • 🎯Conditional Targeting
    • Intro to Conditions
    • Built-in Properties
    • Custom Properties
    • Syntax and Operators
    • Conditional Guides
      • Working with Dates
      • Locations and Weather
      • Event and Property History
  • 🎪Events
    • Event Overview
    • Recommended Events
    • Built-In Events
  • 💬Actions / In App Messaging
    • Actions Overview
    • Modals
      • Modal Content Sections
      • Modal Buttons
      • Modal Images
    • Banners
    • Alerts
    • App Reviews
    • Open Link
    • Custom Actions
    • Conditional Actions
    • Triggers
  • 🎨Themes
    • Theme Overview
    • Built In Themes
  • ⛳Feature Flags
    • Feature Flag Guide
    • Conditional Feature Flags
    • Named Conditions Config
  • 🔑Trustless SaaS
  • 👋Support
  • 👩‍💻SDK API Reference
Powered by GitBook
On this page
  • Button Actions
  • Button Parameters
  • Button Styles
  • Sample Config
  • Automatic Button Events

Was this helpful?

  1. Actions / In App Messaging
  2. Modals

Modal Buttons

Buttons and actions for modals

Last updated 1 year ago

Was this helpful?

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.

Buttons are not required.

Button Actions

By default all buttons dismiss the modal, and only dismiss the modal.

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.

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

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!

Button Parameters

  • title [string, required]: The title of the button

  • style [string, optional]: One of styles described . 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

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

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.

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

Automatic Button Events

Button taps are tracked as events by default. See for details.

💬
below
Modal Built-In Events