@duskmoon-dev/el-input

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

A text input component with label and validation states.

原始使用文档
文档目录17 节
  1. Installation
  2. Usage
  3. Auto-Register (Recommended)
  4. Manual Registration
  5. Input Types
  6. Sizes
  7. Validation States
  8. Attributes
  9. Slots
  10. CSS Parts
  11. Events
  12. CSS Custom Properties
  13. Examples
  14. With Icons
  15. With Validation
  16. With Helper Text
  17. License

@duskmoon-dev/el-input

A text input component with label and validation states.

Installation

bun add @duskmoon-dev/el-input

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-input/register"></script>

<!-- Now use the element -->
<el-dm-input label="Username" placeholder="Enter username"></el-dm-input>
<el-dm-input label="Email" type="email" required></el-dm-input>
<el-dm-input
  label="Password"
  type="password"
  validation-state="invalid"
  error-message="Password is required"
></el-dm-input>

Or with a bundler:

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

Manual Registration

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

<el-dm-input label="Username" placeholder="Enter username"></el-dm-input>

Input Types

TypeDescription
textStandard text input (default)
passwordPassword input
emailEmail input
numberNumber input
telTelephone input
urlURL input
searchSearch input

Sizes

SizeDescription
smSmall
mdMedium (default)
lgLarge

Validation States

StateDescription
validInput is valid (green border)
invalidInput is invalid (red border, shows error)
pendingValidation in progress (shows spinner)

Attributes

AttributeTypeDefaultDescription
typestringtextInput type
valuestring''Current value
namestringForm field name
labelstringLabel text
placeholderstringPlaceholder text
disabledbooleanfalseDisable input
readonlybooleanfalseMake readonly
requiredbooleanfalseMark as required
sizestringmdInput size
validation-statestringValidation state
error-messagestringError message
helper-textstringHelper text

Slots

SlotDescription
prefixContent before input
suffixContent after input

CSS Parts

PartDescription
containerOuter container
labelLabel element
input-wrapperWrapper around input
inputNative input element
prefixPrefix slot wrapper
suffixSuffix slot wrapper
helperHelper text element
errorError message element

Events

EventDetailDescription
dm-input{ value: string }Fired on input
dm-change{ value: string }Fired on change
dm-focusFired on focus
dm-blurFired on blur

CSS Custom Properties

PropertyDescription
--dm-input-heightInput height
--dm-input-padding-xHorizontal padding
--dm-input-font-sizeFont size
--dm-input-border-radiusBorder radius
--dm-input-border-colorBorder color
--dm-input-focus-border-colorFocus border color

Examples

With Icons

<el-dm-input label="Search" type="search">
  <span slot="prefix">&#128269;</span>
</el-dm-input>

With Validation

<el-dm-input
  label="Email"
  type="email"
  validation-state="invalid"
  error-message="Please enter a valid email address"
></el-dm-input>

With Helper Text

<el-dm-input
  label="Password"
  type="password"
  helper-text="Must be at least 8 characters"
></el-dm-input>

License

MIT

版本与发布记录

@duskmoon-dev/el-input 共发布 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-input 的常见问题

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

A text input component with label and validation states.

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

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

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

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

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

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

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

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

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

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

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

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