<!-- Hint text is rendered on the left of the footer -->
<divclass="aui-dialog2-footer-hint">This is a hint.</div>
</footer>
</section>
On its own, the dialog HTML pattern itself is static — the contents are added to the page inline.
To ensure the dialog does not get rendered to the page, you should add class="aui-layer"
and aria-hidden="true" to the dialog element.
Note that in the footer, the hint text (class="aui-dialog2-footer-hint") should be placed
in the DOM below the footer actions (class="aui-dialog2-footer-actions") even though the hint text
appears to the left of the footer actions.
Opening and closing a dialog
You can use JavaScript to make the dialog open and close.
Controls the size of the dialog according to ADG size specifications.
<sectionclass="aui-dialog2 aui-dialog2-small"
role="dialog"
aria-hidden="true">
<!-- inner content -->
</section>
.aui-dialog2-warning
Gives the dialog's header a red background color.
<sectionclass="aui-dialog2 aui-dialog2-warning"
role="dialog"
aria-hidden="true">
<!-- inner content -->
</section>
Attribute
Values
Description
Example Usage
data-aui-modal
true
Specifies that the dialog is modal. Modal dialogs have no close icon in the top right corner, and cannot be
closed by clicking on the blanket behind it.
<sectionclass="aui-dialog2"
data-aui-modal="true"
role="dialog"
aria-hidden="true">
<!-- inner content -->
</section>
data-aui-remove-on-hide
true
Specifies that the dialog element should be removed from the DOM when it is hidden, either by clicking on
the close icon, clicking on the blanket behind the dialog, or calling the hide() method.
<sectionclass="aui-dialog2"
data-aui-remove-on-hide="true"
role="dialog"
aria-hidden="true">
<!-- inner content -->
</section>
data-aui-focus-selector
selector
Controls the element that is focussed when the dialog is opened.
To get a reference to the API for a dialog2 instance, call AJS.dialog2(selector), where selector
can be a selector string, DOM node, or jQuery element.
vardemoDialog=AJS.dialog2("#demo-dialog");
Methods
Method
Description
Example Usage
show
Shows a dialog.
AJS.dialog2("#demo-dialog").show();
hide
Hides a dialog.
AJS.dialog2("#demo-dialog").hide();
remove
Removes the dialog from the DOM.
AJS.dialog2("#demo-dialog").remove();
Events
Events are triggered when dialogs are shown or closed. These can be listened to for a single
dialog instance, or for all dialogs.