Dialog
Dialog
is a UI widget for displaying both modal and non-modal dialog boxes.
Learn more about the Dialog plugin.
constructorβ
constructor(options: Dialog.Options);
The ui.Dialog
constructor accepts several parameters:
widthβ
[optional] The width of the dialog in pixels.
titleβ
[optional] The title of the dialog.
contentβ
[optional] The content of the dialog. It can be a string, HTML, or even a DOM element.
typeβ
[optional] The type of the dialog. This effectively sets a CSS class on the dialog HTML container. The predefined dialog
types are: 'info'
, 'alert'
, 'warning'
, 'success'
, and 'neutral'
.
buttonsβ
[optional] Buttons of the dialog. buttons
is an array of objects of the form
{ action: String, content: String [, position: String] }
.
actionβ
[optional] The name of the action the button represents. When the button is clicked, the dialog object triggers an event
action:[name]
, allowing you to react.
contentβ
[optional] The label of the button (it can be HTML, as well).
positionβ
[optional] It can be 'left'
, 'right'
, or 'center'
. If position is not specified, it is considered to be 'right'
.
If multiple buttons are provided with the same position
, they are placed left-to-right according to the order in which
they were provided.
draggableβ
[optional] If draggable is true
, the dialog window will be draggable by the user. It defaults to false
.
closeButtonβ
[optional] If closeButton
is false
, the dialog window will not display the default "cross" button in the top right
corner allowing the user to close the dialog. It defaults to true
.
closeButtonContentβ
[optional] The HTML content of the little close button in the top right corner of the dialog window. It defaults to a "cross" (x).
modalβ
[optional] If false
, the dialog window will not be made modal. In other words, the user will still be able to interact
with other elements on the page. It defaults to true
.
inlinedβ
[optional] If true
, the dialog window will be inlined in a container that you can pass to the open()
method.