The UI modal element is displayed in front of the page content. It is a pop-up window that can contain text or user interaction elements. The window is triggered by an action or condition. In this document, we will create a basic app that triggers a modal using a slash command.
In your app folder, create a file to define the slash command and the modal. For example,
OpenModalCommand.ts
.Import the following:
In the
OpenModalCommand
class, define the slash command as follows:
This slash command will trigger the modal on the screen.
In the same class, define the modal as follows:
In this case, we have stacked two blocks - the section with text and a divider block.
Update your main app class to call the
OpenModalCommand
class.Deploy and test the app. In any room, send the slash command
/openmodal
.
The following screenshot shows the modal with the content that we defined in the blocks: