import{ ElDmDialog, register }from'@duskmoon-dev/el-dialog';// Register with default tag nameregister();// Or register with custom tag name
customElements.define('my-dialog', ElDmDialog);
Sizes
Size
Description
sm
Small dialog
md
Medium dialog (default)
lg
Large dialog
full
Full-screen dialog
Attributes
Attribute
Type
Default
Description
open
boolean
false
Whether the dialog is open
size
string
'md'
Size: sm, md, lg, full
dismissible
boolean
true
Allow closing via backdrop/escape
no-backdrop
boolean
false
Hide the backdrop
Slots
Slot
Description
(default)
Dialog body content
header
Dialog header/title
footer
Dialog footer with actions
CSS Parts
Part
Description
dialog
The dialog element
backdrop
The backdrop overlay
content
The content wrapper
header
The header section
body
The body section
footer
The footer section
close
The close button
Events
Event
Detail
Description
open
-
Fired when dialog opens
close
-
Fired when dialog closes
Examples
Basic Dialog
<el-dm-buttononclick="document.querySelector('#dialog').open = true">
Open Dialog
</el-dm-button><el-dm-dialogid="dialog"><spanslot="header">Confirmation</span><p>Are you sure you want to proceed?</p><divslot="footer"><el-dm-buttonvariant="ghost"onclick="this.closest('el-dm-dialog').open = false">
Cancel
</el-dm-button><el-dm-buttonvariant="primary">
Confirm
</el-dm-button></div></el-dm-dialog>
<el-dm-dialogdismissible="false"><spanslot="header">Required Action</span><p>You must complete this action.</p><divslot="footer"><el-dm-buttonvariant="primary">Continue</el-dm-button></div></el-dm-dialog>
Programmatic Control
const dialog = document.querySelector('el-dm-dialog');// Open
dialog.open =true;// Close
dialog.open =false;// Listen for events
dialog.addEventListener('close',()=>{
console.log('Dialog closed');});