Add modal to component
Learn how to add a modal in UI Builder. A modal is a window that appears when you click a component. For example, a modal might display when a delete button component is clicked, prompting the user to confirm deleting a record.
Before you begin
Role required: ui_builder_admin
About this task
A modal is a screen that appears when an event handler is triggered by an event such as a button being clicked. The following procedure shows an example of how to add a Confirm modal and an associated event handler to a button component.
Procedure
Navigate to All > Now experience framework > UI Builder.
Open an experience to work in or create an experience by selecting Create > Experience.
See Configure how users interact with your applications in UI Builder for more information on creating experiences.
Open or create a page or page variant.
For more information about how to create a page in UI Builder, see Create a page in UI Builder.
Add a modal to the page.
- Select the + icon in the content tree next to Modals and popovers.
Arrow pointing to + next to Modals and popovers line item in content tree.
2. Choose a modal type such as **Confirm**.
Modal options, with Confirm modal highlighted.
|Modal type|Description|
|----------|-----------|
|Alert|An Alert modal provides information relating to the component action. For example, when a user presses a delete button, you could have an alert pop-up that lets the user know they cannot undo a delete action.|
|Confirm|A Confirm modal asks a user to confirm the component action. For example, when a user presses a delete button, the user would have to confirm the deletion of data. You can choose the confirm options from the primary and secondary button label fields, such as Yes/Cancel.|
|Confirm and destroy|A Confirm and destroy modal is more directive, usually relating to deleting or erasing content. It lets the user know the seriousness of an action, and asks them whether they want to proceed with the action.|
|Custom|The Custom modal uses layouts to let you fully design what information you want in the modal. Layouts also decide where the information sits within the modal screen. You can use Cascading Style Sheets \(CSS\) styling to change the visual look of the modal, such as background color.|
|iframe|Use iframe to bring content into your modal using existing iframe content from a URL and data.|
|Modal viewport|Dynamically pass content into your viewport modal through an event binding using a client script. See [Bind an event to a component](bind-event-component.md) for more information on binding an event to a component.|
3. Configure the modals as shown in the table.
Configure each modal differently, depending on what the modal requires. Change what information goes into the modal, the size of the modal, and how it looks. You can add an event handler to the modal that performs the action for the modal, such as opening or closing the modal.
| Modal | Configuration | ||||
|---|---|---|---|---|---|
| Alert Image omitted: modal-alert-config.png Alert modal configure options tab. |
| ||||
| Confirm Image omitted: modal-confirm-config.png Confirm modal configure options tab. |
Image omitted: modal-event-handler.png Confirm or destroy Image shows the event handler options for a modal.</p></td></tr><tr><td> Image omitted: modal-confirm-destroy-config.png Confirm and destroy modal configure options tab. |
Image omitted: modal-event-handler.png Custom Event handler options for a modal.</p></td></tr><tr><td> Image omitted: modal-custom-config.png Custom modal configure options tab. |
Image omitted: modal-event-handler.png iframe Image shows the event handler options for a modal.</p></td></tr><tr><td> Image omitted: modal-iframe-config.png Iframe modal configure options tab. |
Image omitted: modal-event-handler.png Modal viewport Image shows the event handler options for a modal.</p></td></tr><tr><td> Image omitted: modal-modal-viewport-config.png Modal viewport modal configure options tab. |
Image omitted: modal-event-handler.png Image shows the event handler options for a modal.</p>
Image omitted: uib-modal-viewport-content-tree.png Arrow pointing to a viewport in the content tree.</p>
|
Add a component to your page to trigger the modal you just added, such as a button component.
See Add and configure components for more information.
Select the Events tab in the configuration panel.
Select + Add event handler.
Arrow pointing to the add event handler option for the button component.
Select Open or close modal dialog.
Select the modal you created in the previous steps using the Modal drop-down.
Click Add.
Event handler configuration screen showing the open or close modal dialog settings.
When you finish configuring the modal, close it.
Notice in the content tree that the modals you create sit above the body of your page structure.
Content tree with modals listed.
- Click Save.
Parent Topic:Create modals in UI Builder