Modal

Display a modal dialog box, providing a title, content area, and action buttons.

When To Use

When requiring users to interact with the application without jumping to a new page to interrupt the user's workflow, you can use Modal to create a new overlay layer over the current page for user-getting feedback or information purposes.

Basic

Basic modal.

Edit Profile

Make changes to your profile here. Click save when you're done.

Information modal dialog

In the various types of information modal dialog, only one button to close dialog is provided.

Customized Parts

A more complex example which define a customized footer button bar or header.

A

Custom Header

This modal cannot be closed by clicking outside or pressing Escape because `closable=`. You must provide a button to close it.

Utility Methods

The Modal component automatically exposes window.Modal.open(id) and window.Modal.close(id) global utilities to make it easy to trigger modals from anywhere in your client-side JavaScript.

script.html
<script>
  // Open a modal programmatically
  window.Modal.open('my-modal');

  // Close a modal programmatically
  window.Modal.close('my-modal');
</script>

API Reference

Property
Description
Type
Default

id

A unique identifier for the modal, required for opening/closing. string -

title

Optional title text for the modal header. string -

description

Optional description text displayed below the title. string -

variant

Semantic style variant determining the icon and border color. 'default' | 'success' | 'error' | 'info' | 'warning' 'default'

closable

If true, shows a close button and allows closing via backdrop or ESC. boolean true

draggable

If true, allows the user to drag the modal by its header. boolean false

resizable

If true, allows the user to resize the modal from the bottom right. boolean false

width

Custom width (e.g., "600px", "80vw"). string -

height

Custom height (e.g., "400px", "50vh"). string -