@delement/ui

中文文档
0.9.9-156发布于 2026/10/27MITTypeScriptES Module近 30 天下载 2009

TypeScript React UI component library with plugins, utilities, ESM modules, and SSR-friendly architecture.

原始使用文档
文档目录14 节
  1. Features
  2. Why Choose DElement UI?
  3. Installation
  4. Quick Start
  5. Usage
  6. Components
  7. Plugins
  8. React Utilities
  9. Server HTML
  10. Constants
  11. Webpack Utilities
  12. Styles (Bundle or Per-Component Chunks)
  13. Contributing
  14. Documentation

TypeScript React UI Component Library by Digital Element

npm version npm downloads license

DElement UI is a TypeScript-first React UI component library with plugins, shared utilities, and Storybook documentation.

Built for modern front-end applications with:

  • ESM-only distribution
  • tree-shakable modules
  • SSR-friendly architecture
  • built-in localization support

Features

  • React UI components for production interfaces
  • Basic accessibility defaults in core components
  • Plugin architecture for DOM and UX workflows
  • TypeScript public typings via @delement/ui/typings
  • Tree-shakable ESM modules
  • SSR-friendly behavior
  • Storybook documentation and examples

Why Choose DElement UI?

  • React components for common product interfaces
  • Plugins for DOM/UX workflows (forms, collections, localization, etc.)
  • Utility packages for React, Node, Webpack, and MSW
  • Typed public API via @delement/ui/typings
  • Ready-to-use styles bundle and per-component style chunks

Installation

npm i @delement/ui

Quick Start

import { Btn } from "@delement/ui/components";

export const App = () => <Btn label={"Submit"} />;

Usage

Components

// from directory
import { Btn, Input, DatePicker, Map, Locale, /* etc */ } from "@delement/ui/components";
// or directly
import { Btn } from "@delement/ui/components/btn";

Plugins

// from directory
import { Collection, Localisation, FormValidation,  /* etc */ } from "@delement/ui/plugins";
// or directly
import { Collection } from "@delement/ui/plugins/collection";

Component/plugin subpaths use wildcard maps in package.json, including nested index modules. For example:

import { BlockTable } from "@delement/ui/components/blockTable";
import { FormSend } from "@delement/ui/plugins/forms";
import type { TLocalisationSource } from "@delement/ui/plugins/localisation/types";

Subcomponents are available on their parent: BlockTable.Body, BlockTable.Caption, BlockTable.Cell, BlockTable.Foot, BlockTable.Head, BlockTable.Row, BlockTable.SortBtn, Grid.Item, Form.Block, Form.Col, Form.Field, Form.Msg and Form.Row. Replace former named imports such as BlockTableBody, GridItem and FormField from the main component entrypoints with the parent import and property access.

React Utilities

// from directory
import { useCN, useIO  /* etc */ } from "@delement/ui/utils/react";
// or directly
import { useCN } from "@delement/ui/utils/react/useCN";

Server HTML

getStaticMarkupForServer returns HTML without automatic pretty-printing in both development and production, for SSG and SSR modes. The before, after and getWithModifier options remain available:

import { getStaticMarkupForServer } from "@delement/ui/utils/react";

const html = await getStaticMarkupForServer(<div>Hello</div>, { mode: "SSR" });
// <!DOCTYPE html><div>Hello</div>

Production output that previously received indentation and line breaks is now compact. Apply any optional formatting in your own tooling. getPrettyHTML is no longer exported from @delement/ui/utils; remove that import from consumer code. Storybook snippets keep their internal HTML formatter.

Constants

import { constants } from "@delement/ui/constants";

Webpack Utilities

getFilesWithContext remains available for loading icons, lazy styles and other modules through import.meta.webpackContext in Webpack applications:

import { getFilesWithContext } from "@delement/ui/utils/webpack";

The direct subpath is also supported:

import { getFilesWithContext } from "@delement/ui/utils/webpack/getFilesWithContext";

Webpack configuration helpers and plugins have been removed from this package.

Styles (Bundle or Per-Component Chunks)

Make sure to add the deUI class to your root <html> element.

// bundle
import styles from "@delement/ui/styles" with { type: "css" };

// or directly for components
import buttonStyles from "@delement/ui/styles/components/btn" with { type: "css" };

Contributing

Use Node.js >=24 and npm.cmd in PowerShell. npm.cmd run lint checks without rewriting files; use npm.cmd run lint::fix for an explicit formatting pass. Run the relevant typecheck::* and tests, then npm.cmd run build::package and npm.cmd run check::package for package output changes. The build does not repeat lint/tests. Storybook build is a separate, explicitly requested check. The published npm package excludes Storybook sources, site output, dependencies and commands.


Documentation

See more examples and API at our website.

版本与发布记录

@delement/ui 共发布 168 个版本,首次发布于 2024/02/29;过去 12 个月发布了 32 个版本。

版本发布日期距今
0.9.9-156latest2026/10/2718 天前
0.9.9-1552026/10/061 个月前
0.9.9-1542026/09/042 个月前
0.9.9-1522026/08/123 个月前
0.9.9-1512026/08/123 个月前
0.9.9-1502026/08/103 个月前

关于 @delement/ui 的常见问题

@delement/ui 是什么?

TypeScript React UI component library with plugins, utilities, ESM modules, and SSR-friendly architecture.

如何安装 @delement/ui?

在项目目录运行 npm install @delement/ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:msw(^2.15.0)、yup(^1.7.1)、react(^19.3.1)、i18next(^26.5.11)、date-fns(^4.4.0)、react-dom(^19.3.1)、ssr-window(^5.0.1)、react-imask(^7.6.1)、react-select(^5.10.2)、@fancyapps/ui(^6.1.14)、react-i18next(^17.1.9)、@web3r/flowerkit(^1.2.1)、react-datepicker(^9.1.0)、react-content-loader(^7.1.2)、@pbe/react-yandex-maps(^1.2.5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@delement/ui 支持 TypeScript 吗?

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

@delement/ui 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@delement/ui 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@delement/ui 可以商用吗?

@delement/ui 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@delement/ui 的下载量有多少?

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

@delement/ui 还在维护吗?

最新版本 0.9.9-156 发布于 2026/10/27(18 天前);至今共发布 168 个版本,其中过去 12 个月发布了 32 个;首次发布于 2024/02/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。