@duskmoon-dev/el-alert

中文文档
1.10.3发布于 2026/11/11TypeScriptESM + CJS构建来源已验证近 30 天下载 2532

A customizable alert component for displaying messages built with Web Components.

原始使用文档
文档目录18 节
  1. Installation
  2. Usage
  3. Auto-Register
  4. Manual Registration
  5. Types
  6. Variants
  7. Attributes
  8. Slots
  9. CSS Parts
  10. Events
  11. Examples
  12. Basic Types
  13. With Title
  14. Dismissible
  15. Variants
  16. Compact
  17. With Actions
  18. License

@duskmoon-dev/el-alert

A customizable alert component for displaying messages built with Web Components.

Installation

bun add @duskmoon-dev/el-alert

Usage

Auto-Register

import '@duskmoon-dev/el-alert/register';
<el-dm-alert type="success">Operation completed successfully!</el-dm-alert>

Manual Registration

import { ElDmAlert, register } from '@duskmoon-dev/el-alert';

// Register with default tag name
register();

// Or register with custom tag name
customElements.define('my-alert', ElDmAlert);

Types

TypeDescription
infoInformational message (default)
successSuccess message
warningWarning message
errorError message

Variants

VariantDescription
filledFilled background (default)
outlinedOutlined style
softSoft/subtle background

Attributes

AttributeTypeDefaultDescription
typestring'info'Alert type: info, success, warning, error
variantstring'filled'Style variant: filled, outlined, soft
dismissiblebooleanfalseShow dismiss button
compactbooleanfalseCompact display mode
titlestring''Alert title

Slots

SlotDescription
(default)Alert content
iconCustom icon
actionsAction buttons

CSS Parts

PartDescription
alertThe main alert container
iconThe icon container
contentThe content wrapper
titleThe title element
closeThe close button

Events

EventDetailDescription
dismiss-Fired when alert is dismissed

Examples

Basic Types

<el-dm-alert type="info">This is an info alert.</el-dm-alert>
<el-dm-alert type="success">This is a success alert.</el-dm-alert>
<el-dm-alert type="warning">This is a warning alert.</el-dm-alert>
<el-dm-alert type="error">This is an error alert.</el-dm-alert>

With Title

<el-dm-alert type="success" title="Success!">
  Your changes have been saved.
</el-dm-alert>

Dismissible

<el-dm-alert type="info" dismissible>
  Click the X to dismiss this alert.
</el-dm-alert>

Variants

<el-dm-alert type="info" variant="filled">Filled</el-dm-alert>
<el-dm-alert type="info" variant="outlined">Outlined</el-dm-alert>
<el-dm-alert type="info" variant="soft">Soft</el-dm-alert>

Compact

<el-dm-alert type="info" compact>Compact alert</el-dm-alert>

With Actions

<el-dm-alert type="warning" dismissible>
  Your session is about to expire.
  <div slot="actions">
    <el-dm-button size="sm">Extend</el-dm-button>
  </div>
</el-dm-alert>

License

MIT

版本与发布记录

@duskmoon-dev/el-alert 共发布 51 个版本,首次发布于 2026/01/13;过去 12 个月发布了 51 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.10.3latest2026/11/112 天前
1.10.22026/10/2222 天前
1.10.12026/10/1627 天前
1.10.02026/10/1628 天前
1.9.32026/10/131 个月前
1.9.22026/10/131 个月前

关于 @duskmoon-dev/el-alert 的常见问题

@duskmoon-dev/el-alert 是什么?

A customizable alert component for displaying messages built with Web Components.

如何安装 @duskmoon-dev/el-alert?

在项目目录运行 npm install @duskmoon-dev/el-alert,或使用 pnpm add / yarn add / bun add。

@duskmoon-dev/el-alert 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@duskmoon-dev/el-alert 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@duskmoon-dev/el-alert 可以商用吗?

@duskmoon-dev/el-alert 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@duskmoon-dev/el-alert 的下载量有多少?

根据 npm 官方下载统计,@duskmoon-dev/el-alert 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,532 次,日均约 84 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@duskmoon-dev/el-alert 还在维护吗?

最新版本 1.10.3 发布于 2026/11/11(2 天前);至今共发布 51 个版本,其中过去 12 个月发布了 51 个;首次发布于 2026/01/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。