dialog
Last updated
Last updated
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 .
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 casesThere are 3 main use cases for dialog
. These are described in more detail below.
dialogs
dialogs
dialogs
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
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
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:
id
Required
The id
attribute is required to target a particular dialog to call show()
or hide()
on it.
See also:
title
Optional
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?”)
auto-hide
Optional
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
Optional
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-submit
Optional
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.
submit-text
and cancel-text
Optional
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
Optional
Type: string
Default: unset
scrollIntoView
Programmatically scroll until the component is visible in the view.
Type: string
(static text, a or the return value of a )
on-cancel
is an event that calls a JS/TS or . See more details:
on-submit
is an event that calls a JS/TS or . See more details:
See example for .
Subtext provides more detail to the user about the purpose of the dialog. The subtext
attribute can be a and it also supports newline characters.
The following component methods are available when an is assigned to the component and component.dialog({id:'my-id'})
is called from JS/TS: