import{ ElDmAlert, register }from'@duskmoon-dev/el-alert';// Register with default tag nameregister();// Or register with custom tag name
customElements.define('my-alert', ElDmAlert);
Types
Type
Description
info
Informational message (default)
success
Success message
warning
Warning message
error
Error message
Variants
Variant
Description
filled
Filled background (default)
outlined
Outlined style
soft
Soft/subtle background
Attributes
Attribute
Type
Default
Description
type
string
'info'
Alert type: info, success, warning, error
variant
string
'filled'
Style variant: filled, outlined, soft
dismissible
boolean
false
Show dismiss button
compact
boolean
false
Compact display mode
title
string
''
Alert title
Slots
Slot
Description
(default)
Alert content
icon
Custom icon
actions
Action buttons
CSS Parts
Part
Description
alert
The main alert container
icon
The icon container
content
The content wrapper
title
The title element
close
The close button
Events
Event
Detail
Description
dismiss
-
Fired when alert is dismissed
Examples
Basic Types
<el-dm-alerttype="info">This is an info alert.</el-dm-alert><el-dm-alerttype="success">This is a success alert.</el-dm-alert><el-dm-alerttype="warning">This is a warning alert.</el-dm-alert><el-dm-alerttype="error">This is an error alert.</el-dm-alert>
With Title
<el-dm-alerttype="success"title="Success!">
Your changes have been saved.
</el-dm-alert>
Dismissible
<el-dm-alerttype="info"dismissible>
Click the X to dismiss this alert.
</el-dm-alert>
<el-dm-alerttype="warning"dismissible>
Your session is about to expire.
<divslot="actions"><el-dm-buttonsize="sm">Extend</el-dm-button></div></el-dm-alert>