@byline/ui

中文文档
6.13.0发布于 2026/11/04MPL-2.0TypeScriptES Module近 30 天下载 2367

Byline CMS UI package

原始使用文档
文档目录3 节
  1. Relationship to @infonomic/uikit
  2. Storybook
  3. License

@byline/ui

Framework-independent React primitives for Byline CMS, including buttons, inputs, overlays, icons, and drag-and-drop components. CMS field widgets and document-editor forms belong to @byline/admin.

This package is part of Byline CMS — a developer-friendly, open-source headless CMS with versioning, editorial workflow, and content translation as first-class concerns.

For documentation, the full architecture overview, and getting started instructions, see the main repository: https://github.com/Byline-CMS/bylinecms.dev.

Relationship to @infonomic/uikit

The foundational surface of this package — the components, icons, hooks, lib, loaders, styles, utils, and widgets directories, plus uikit.ts — is shared with @infonomic/uikit. The two kits are kept in step by porting changes manually, in whichever direction a change originates: a change made here is ported upstream, a change made upstream is ported here. Either copy may be edited directly; neither is the sole source of truth.

Byline's dnd/ components and react.ts entry point have no upstream counterpart.

Storybook

Storybook lets you inspect and interact with the UI primitives without starting the CMS or a database. The stories are ported from the sibling UI kit and live beside their components in src/**/*.stories.tsx.

After installing the workspace dependencies, run from the repository root:

pnpm storybook

Open http://localhost:6007. The preview includes the UI kit's reset, theme, typography, local fonts, drawer provider, and toast provider. Use the toolbar to switch between light and dark themes. The accessibility panel runs checks against the selected story; documentation pages and controls are also available.

Build a static site with:

pnpm build-storybook

The output is packages/ui/storybook-static/, which is ignored by Git. Both commands also work with pnpm --filter @byline/ui before the command name. Port 6007 matches the sibling kit; stop its server before starting this one, or run pnpm --filter @byline/ui storybook --port 6008 to use a different port.

Configuration lives in .storybook/main.ts and .storybook/preview.tsx. Static preview assets live in public/, with font licences beside the fonts. The preview applies .byline-ui to the iframe body so portalled overlays inherit the same scoped styles as the stories. Story layout uses inline styles and does not require the web application's Tailwind configuration.

When adding a story, import components from their local source modules and Storybook types from @storybook/react-vite. The package's typecheck command checks stories and configuration; the library build excludes story modules. Run the static build and inspect changed stories in the browser before merging.

License

MPL-2.0

版本与发布记录

@byline/ui 共发布 175 个版本,首次发布于 2026/05/03;过去 12 个月发布了 175 个版本。

版本发布日期距今
6.13.0latest2026/11/044 天前
6.12.12026/11/026 天前
6.12.02026/10/318 天前
6.11.02026/10/2514 天前
6.10.12026/10/2217 天前
6.10.02026/10/2217 天前

关于 @byline/ui 的常见问题

@byline/ui 是什么?

Byline CMS UI package

如何安装 @byline/ui?

在项目目录运行 npm install @byline/ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^19.0.0)、react-dom(^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@byline/ui 支持 TypeScript 吗?

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

@byline/ui 支持 ESM 还是 CommonJS?

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

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

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

@byline/ui 可以商用吗?

@byline/ui 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

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

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

@byline/ui 还在维护吗?

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