@duskmoon-dev/el-card

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

A container component with header, body, and footer sections.

原始使用文档
文档目录15 节
  1. Installation
  2. Usage
  3. Auto-Register (Recommended)
  4. Manual Registration
  5. Variants
  6. Padding
  7. Attributes
  8. Slots
  9. CSS Parts
  10. CSS Custom Properties
  11. Examples
  12. With Media
  13. Interactive Card
  14. Outlined Variant
  15. License

@duskmoon-dev/el-card

A container component with header, body, and footer sections.

Installation

bun add @duskmoon-dev/el-card

Usage

The simplest way to use the component - just import and it's ready:

<!-- Via CDN -->
<script type="module" src="https://esm.sh/@duskmoon-dev/el-card/register"></script>

<!-- Now use the element -->
<el-dm-card>
  <h3 slot="header">Card Title</h3>
  <p>Card body content goes here.</p>
  <div slot="footer">
    <button>Action</button>
  </div>
</el-dm-card>

Or with a bundler:

import '@duskmoon-dev/el-card/register';

Manual Registration

<script type="module">
  import { register } from '@duskmoon-dev/el-card';
  register();
</script>

<el-dm-card>
  <h3 slot="header">Card Title</h3>
  <p>Card body content goes here.</p>
</el-dm-card>

Variants

VariantDescription
elevatedRaised card with shadow (default)
outlinedCard with border
filledCard with subtle background

Padding

SizeDescription
noneNo padding
smSmall padding
mdMedium padding (default)
lgLarge padding

Attributes

AttributeTypeDefaultDescription
variantstringelevatedCard variant
interactivebooleanfalseMake card clickable
paddingstringmdPadding size

Slots

SlotDescription
(default)Card body content
headerHeader section
footerFooter section
mediaMedia content (image/video) at top

CSS Parts

PartDescription
cardMain card container
headerHeader section
bodyBody section
footerFooter section
mediaMedia section

CSS Custom Properties

PropertyDescription
--dm-card-paddingCard padding
--dm-card-border-radiusBorder radius
--dm-card-backgroundBackground color
--dm-card-border-colorBorder color
--dm-card-shadowBox shadow

Examples

With Media

<el-dm-card>
  <img slot="media" src="image.jpg" alt="Card image" />
  <h3 slot="header">Image Card</h3>
  <p>Description of the image.</p>
</el-dm-card>

Interactive Card

<el-dm-card interactive onclick="handleClick()">
  <h3 slot="header">Clickable Card</h3>
  <p>Click me!</p>
</el-dm-card>

Outlined Variant

<el-dm-card variant="outlined">
  <p>Outlined card content.</p>
</el-dm-card>

License

MIT

版本与发布记录

@duskmoon-dev/el-card 共发布 54 个版本,首次发布于 2026/01/04;过去 12 个月发布了 54 个版本。最新版本附带 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-card 的常见问题

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

A container component with header, body, and footer sections.

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

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

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

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

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

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

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

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

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

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

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

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