alert
The alert function, a wrapper for the <mdui-dialog> component, supersedes the native window.alert function, enabling the creation of alert dialogs without HTML code.
<mdui-button class="example-button">open</mdui-button>
<script type="module">
  import { alert } from "mdui/functions/alert.js";
  const button = document.querySelector(".example-button");
  button.addEventListener("click", () => {
    alert({
      headline: "Alert Title",
      description: "Alert description",
      confirmText: "OK",
      onConfirm: () => console.log("confirmed"),
    });
  });
</script>API
alert(options: Options): Promise<void>The alert function takes an Options object and returns a Promise. The Promise resolves if the dialog is closed by clicking the confirm button, and rejects if closed by other means.
Options
| Property | Type | Default | 
|---|---|---|
| headline | string | - | 
| The title of the dialog. | ||
| description | string | - | 
| The description of the dialog. | ||
| icon | string | - | 
| The Material Icons name displayed at the top of the dialog. | ||
| closeOnEsc | boolean | false | 
| Whether the dialog can be closed by pressing the Esc key. If set to true, the dialog closes when the Esc key is pressed. | ||
| closeOnOverlayClick | boolean | false | 
| Whether the dialog can be closed by clicking on the overlay. | ||
| confirmText | string | OK | 
| The text for the confirm button. | ||
| queue | string | - | 
| The queue name. By default, the queue is disabled. If this function is invoked multiple times, multiple dialogs will appear simultaneously. If a queue name is provided, dialogs with the same queue name will open sequentially, each one after the previous one closes. The  | ||
| onConfirm | (dialog: Dialog) => void | boolean | Promise<void> | - | 
| A callback function that is triggered when the confirm button is clicked. The function receives the dialog instance as a parameter, and  By default, clicking the confirm button closes the dialog. If the return value is  | ||
| onOpen | (dialog: Dialog) => void | - | 
| A callback function that is triggered when the dialog starts to open. The function receives the dialog instance as a parameter, and  | ||
| onOpened | (dialog: Dialog) => void | - | 
| A callback function that is triggered when the dialog's opening animation completes. The function receives the dialog instance as a parameter, and  | ||
| onClose | (dialog: Dialog) => void | - | 
| A callback function that is triggered when the dialog starts to close. The function receives the dialog instance as a parameter, and  | ||
| onClosed | (dialog: Dialog) => void | - | 
| A callback function that is triggered when the dialog's closing animation completes. The function receives the dialog instance as a parameter, and  | ||
| onOverlayClick | (dialog: Dialog) => void | - | 
| A callback function that is triggered when the overlay is clicked. The function receives the dialog instance as a parameter, and  | ||