dialog
Overview
The dialog UI component appears as a blocking overlay that provides information or confirms destructive behavior. They often prompt users to make a decision.
This dialog component is generated from the view's XML. For dialogs triggered from JavaScript/TypeScript, see the journey.dialog documentation.
Known limitation
A dialog can currently not be shown upon entering a view (e.g. by calling it from the init() or resume() function).
dialog use cases
dialog use casesThere are 3 main use cases for dialog. These are described in more detail below.
Simple dialogs
Confirmation dialogs
Composition dialogs
Simple
A simple dialog displays information to the user and does not require the user to make a decision, thus can be dismissed by selecting the primary button, hitting the Esc key or back button.
Example

Confirmation
A confirmation dialog gives the user the ability to provide final confirmation of a decision before committing to it. If the user confirms a choice, it’s carried out. Otherwise, the user can dismiss the dialog by selecting the secondary button.
Example

Composition
A composition dialogs allows developers to embed other UI components inside it, therefore offering a wide range of input options.
To embed a UI component to the dialog, add it inside a body tag. Refer to the syntax for more detail.
Example:

Standard Attributes
id
idRequired
The id attribute is required to target a particular dialog to call show() or hide() on it.
See also:
idtitle
titleOptional
Type: string (static text, a format string or the return value of a JS/TS function)
Default: unset
A dialog's title communicates its purpose to the user.
Titles should:
Contain a brief, clear statement or question
Summarize the dialog's content
Avoid the following:
apologies (“Sorry for the interruption”)
alarm (“Warning!”)
ambiguity (“Are you sure?”)
Advanced Attributes
auto-hide
auto-hideOptional
Type: boolean
Default: true
By default the dialog will automatically hide when the user selects any of its buttons. To override this behavior, specify auto-hide="false".
When specifying auto-hide="false", you are responsible for hiding the dialog using component.dialog({id:'myId'}).hide().
on-cancel
on-cancelOptional
Default: unset
Triggered when: The secondary button on a confirmation dialog is selected.
Event parameter: Empty by default. Can be a user-defined variable or field.
Return value: undefined, or the user-defined variable or field
on-cancel is an event that calls a JS/TS $:function or navigation. See more details:
on-submit
on-submitOptional
Default: unset
Triggered when: The primary button (for simple dialogs) or submit button (for multi-button dialogs) on a dialog is selected.
Event parameter: Empty by default. Can be a user-defined variable or field.
Return value: undefined, or the user-defined variable or field.
on-submit is an event that calls a JS/TS $:function or navigation. See more details:
See example for on-cancel.
submit-text and cancel-text
submit-text and cancel-textOptional
Type: string
Default: The default submit (primary) button text is OK and for confirmation dialogs the default cancel button text is Cancel. These will be translated by default.
The submit-text and cancel-text attributes allows for changing the default text on the dialog.
Be as specific as possible with button copy to avoid ambiguity. Instead of "Yes", rather repeat the action that a button will trigger - for example "Discard", "Save" or "Reset"
subtext
subtextOptional
Type: string
Default: unset
Subtext provides more detail to the user about the purpose of the dialog. The subtext attribute can be a format string and it also supports newline characters.
Component Methods
The following component methods are available when an id is assigned to the component and component.dialog({id:'my-id'}) is called from JS/TS:
scrollIntoView
scrollIntoViewProgrammatically scroll until the component is visible in the view.
Last updated