@risklab/ui

中文文档
1.1.0发布于 2026/11/02Apache-2.0TypeScriptESM + CJS零依赖

@risklab/ui - Standalone vanilla Web Component UI library. Root install for the no-framework package surface.

原始使用文档
文档目录4 节
  1. Install
  2. Quick start
  3. Styling and tokens
  4. Package notes

@risklab/ui

@risklab/ui is the standalone vanilla RiskLab UI package.

Use it when you want:

  • framework-agnostic Web Components
  • zero runtime dependencies
  • a package that can drop into static sites, dashboards, kiosks, or mixed stacks
  • the same CSS token system used by the other RiskLab UI packages

If you are building a React application, prefer @risklab/ui-react.

Install

npm install @risklab/ui

Quick start

import "@risklab/ui/auto";
import "@risklab/ui/css";

document.body.innerHTML = `
  <div class="ui-root">
    <ui-button variant="filled" color="primary">Run report</ui-button>
    <ui-text-field label="Search" placeholder="Find assets"></ui-text-field>
  </div>
`;

Use @risklab/ui/auto when you want all built-in custom elements registered. If you want more control, import the specific surface you need from @risklab/ui/inputs, @risklab/ui/layout, @risklab/ui/data-display, and the other category entrypoints.

Styling and tokens

import "@risklab/ui/css";

RiskLab UI uses CSS custom properties so it can live inside an existing design system without forcing one visual identity.

:root {
  --ui-color-primary: #0057d9;
  --ui-color-surface: #ffffff;
  --ui-color-text: #111827;
  --ui-font-family: "Segoe UI", sans-serif;
  --ui-radius-md: 6px;
}

Dark mode is opt-in through [data-ui-theme="dark"] or .ui-dark.

Package notes

  • @risklab/ui is the default vanilla package.
  • @risklab/ui-vanilla ships the same model for teams that prefer explicit package naming symmetry with @risklab/ui-react, @risklab/ui-vue, and the other framework packages.
  • Published package surface has no install-time dependencies.

版本与发布记录

@risklab/ui 共发布 3 个版本,首次发布于 2026/11/02;过去 12 个月发布了 3 个版本。

版本发布日期距今
1.1.0latest2026/11/021 天前
0.0.0-stage2026/11/021 天前
1.0.02026/07/173 个月前

关于 @risklab/ui 的常见问题

@risklab/ui 是什么?

@risklab/ui -独立的香草Web组件ui库。根安装用于无框架包表面。

如何安装 @risklab/ui?

在项目目录运行 npm install @risklab/ui,或使用 pnpm add / yarn add / bun add。

@risklab/ui 支持 TypeScript 吗?

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

@risklab/ui 支持 ESM 还是 CommonJS?

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

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

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

@risklab/ui 可以商用吗?

@risklab/ui 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@risklab/ui 还在维护吗?

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