Use UI Builder to place extra content in front of a user: modals, popovers, modeless dialogs and viewports. A modal blocks the page until someone closes it. A popover shows a small amount of contextual detail. A modeless dialog floats above the page while the page stays usable. A viewport embeds a separate subpage or experience.
Choosing between overlays, dialogs and viewports
The four components differ on three questions: whether the page keeps working underneath, how much content fits, and how the window closes.
| Component | Page stays usable underneath | Typical content | How it closes |
|---|---|---|---|
| Modal | No, until it is closed | Alerts, confirmations, custom layouts, iframes | The close control, or one of its buttons |
| Popover | Yes | A few lines of information, short options or links | When the user stops interacting with it |
| Modeless dialog | Yes | Forms, email composers, attachments, chat, notes | The user closes, minimizes or leaves it open |
| Viewport modal | No, until it is closed | Subpages or other experiences | The close control, or a modal button |
If the user must answer a question before anything else happens, use a modal. If the user needs the page in view while they work in a window, use a modeless dialog. If the window is a hint attached to one element, a popover fits.
Modals: blocking windows for alerts and confirmations
A modal is a window that sits over the page. Until the user closes it, they cannot work in the content behind it. Modals can hold text, forms, images and buttons, and UI Builder ships with preconfigured modal types.
Modal types and what they are for
- Alert gives information about an action, such as a warning that a deletion cannot be undone.
- Confirm asks the user to agree to an action. You set the primary and secondary button labels, such as Yes and Cancel.
- Confirm and destroy suits deleting or erasing content. It makes the seriousness of the step plain.
- Custom works as a container. Use layout to arrange what it holds, and CSS to style the result.
- iframe brings existing content from a URL into the modal, along with the parameters and initial data you define.
- Modal viewport receives content through an event binding using a client script.
A modal has a header, content, a close dialog control and at least one modal button. The close control closes the window without taking an action of its own. The modal buttons are the ones that carry out actions.
Adding a modal and connecting it to a button
The ui_builder_admin role is required.
- Open the experience, then the page or page variant you are editing.
- Select the plus icon beside Modals and popovers in the content tree, then choose a modal type.
- Enter the header, content and button labels, then choose a size: Small, Medium, Large or Fullscreen.
- Decide whether the button action closes the modal. For an alert modal, enable or disable Prevent Default Button Action, depending on whether the button should close the modal by default. For confirm types, use Prevent Default Primary Button Action and Prevent Default Secondary Button Action in the same way.
- Turn on Defer modal content loading if the modal should wait until someone opens it.
- Select the button, open its Events tab, add an Open or close modal dialog handler, enable Open modal dialog, and pick the modal.
- Save, then select Preview and test the button.
For iframe modals, the disable sandbox option matters. Turning it on lifts the allow-forms, allow-modals, allow-popups, allow-presentation, allow-same-origin, allow-scripts and allow-downloads restrictions. Leaving it off lifts just the allow-scripts restriction.
Popovers: small windows for contextual detail
A popover is a small window above the page that carries information, options or actions tied to what the user is doing. You add components to it the same way you add them to a modal.
Keep popovers short, because they are meant to hold small pieces of information. A popover can also appear through event mapping, such as when a button is selected or the pointer rests on part of the page.
The admin role is required. Then follow these steps:
- Add the component that will trigger the popover, such as a button.
- Open its Events tab and Add event handler
- Select Open Popover, then Create a new popover, then Add.
- Add components inside the popover with the plus icon, then close it.
- Save, select Preview, and click the button to test the popover.
Modeless dialogs: floating windows that keep the page live
A modeless dialog is a floating window with components inside it, placed above the page. The user works in the dialog and in the page beneath it at the same time. You can add several dialogs to one page, and each can be resized, moved and minimized.
Anatomy and setup
The header carries minimize, expand and close icons by default. The body accepts any toolbox component, such as Email composer, Attachments or Agent chat, and you can apply layouts to arrange them. A footer is optional.
The ui_builder_admin role is required. Select the plus icon beside Modeless dialogs in the content tree and choose the Modeless dialog component. UI Builder adds preset values for width, height, position and drag, each editable, plus a Modeless dialog controller in the data resources drawer. It also places a Minimized dialogs dropdown under Body, which supplies the minimize behavior.
To open the dialog from a button, add an Open Modeless dialog handler on the button’s Events tab. It takes a heading, a minimized heading, a category, the dialog to open and a single-instance setting. With single instance on, users can open one copy. With it off, they can open several, as in the example of several email composers.
The five modeless dialog events
| Event handler | What it does |
|---|---|
| Open Modeless Dialog | Opens a dialog, with heading, minimized heading, category and single-instance options |
| Close Modeless Dialog | Closes a dialog from outside its own window, using its instance ID |
| Minimize Modeless Dialog | Minimizes a dialog from a control outside the window |
| Update Modeless Dialog | Changes the heading, minimized heading or category, and can mark the dialog dirty |
| Dirty Modeless Dialog | Marks a dialog as dirty |
Each handler has a When to trigger setting: Always, or Conditionally with a test written in the component formula editor’s supported functions.
Viewports: embedding subpages, tabs and experiences
Viewports let you extend an experience without owning the parent page. You can add a viewport component to a page, replace a tab with a viewport-enabled tab, or add a viewport to the Contextual sidebar component.
Adding a viewport component
- Add a single-column layout, then search the toolbox for viewport and select the Viewport component.
- In the configuration panel, select a page collection or create one. One page of the collection at a time shows in the staging area.
- Save, then note the viewport ID and route shown in the Config panel.
- Add a button, open its Events tab, and select Add event handler.
- Under Page-level event handlers, choose UXF Macroponent Viewport Load Requested.
- Replace the null value in viewportElementID with the viewport ID, such as viewport_1, then select Add and Save.
Replacing a tab with a viewport-enabled tab
Viewport-enabled tabs suit third-party custom data, audience targeting and variants. The admin role is required. The change is permanent and one way, and it removes the tab’s existing content, so you rebuild that content inside the viewport tab. Select the Tabs component, choose Replace with viewport tabs, then Edit content. Create a new page with a name and path, name its variant, and add audiences. You can also set display conditions with the dropdown menus or an encoded query string. Bind a data source in Data driven tabs if the tab needs record data, then choose whether the labels show or icons appear alone.
Viewport modals
A viewport modal embeds a subpage or another experience inside a modal on your parent page. It opens through an event or a script. Each viewport modal holds one subroute, so create another viewport modal for each extra route.
The ui_builder_admin role is required. Select the plus icon beside Modals, choose Viewport Modal, select the viewport, and add a page collection in its Configure tab. Then add a button with an Open or close modal dialog handler, enable Open modal dialog, and choose the viewport modal. The viewport ID fills in automatically. You can set the modal size, turn on Hide Padding, or turn on Hide Close Button. Work on an existing page in the scope, since scope controls which parts of an application a page can reach.
Frequently asked questions
Can a modal hold a form?
Yes. Modals can contain forms. A custom modal lets you place components inside layout containers, so you can build the form around the decision the user is making.
Which modal type fits a delete action?
Confirm and destroy suits deleting or erasing content, because it signals the seriousness of the step and asks the user whether to proceed.
Does a modeless dialog stop people using the page?
No. The user can work in the dialog and in the page underneath at the same time. A minimized dialog stays available through the Minimized dialogs dropdown.
What makes a popover close?
It displays only while the user interacts with it. Because of that, a popover should hold a small amount of information, a few options or a link to related content.