@ferrlabs/ui-ng

中文文档
1.51.0发布于 2026/11/14MIT OR Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 9827

FerrLabs design system: Angular 22 components (standalone, signals, zoneless), themed by the tokens of @ferrlabs/ui-foundation.

原始使用文档
文档目录6 节
  1. Install
  2. Usage
  3. Versioned docs ( @ferrlabs/ui-ng/docs )
  4. Markdown and code ( @ferrlabs/ui-ng/markdown )
  5. Conventions
  6. License

@ferrlabs/ui-ng

FerrLabs design system — Angular 22 components (standalone, signals, zoneless).

Sibling of @ferrlabs/ui-react: same design language, same tokens. Visual parity comes from the shared, framework-agnostic @ferrlabs/ui-foundation (token CSS variables + Tailwind layers) — ui-ng ships no design values of its own, it reads --color-accent, --color-fg, --font-mono, etc.

Status: WIP. Scaffold + first primitive (Button). The rest of the ~40 primitives + app chrome are being ported surface-by-surface during the React → Angular migration. At the end of the migration this becomes the only component library and is renamed to @ferrlabs/ui.

Install

pnpm add @ferrlabs/ui-ng @ferrlabs/ui-foundation

Pull the tokens once (e.g. in your global stylesheet or Tailwind entry):

@import '@ferrlabs/ui-foundation/styles/tokens.css';

Usage

import { ButtonComponent } from '@ferrlabs/ui-ng';

@Component({
  imports: [ButtonComponent],
  template: `
    <flr-button variant="primary" size="md" (pressed)="save()">Save</flr-button>
    <flr-button variant="ghost" [loading]="saving()">Saving…</flr-button>
    <flr-button variant="danger" href="/delete">Delete</flr-button>
  `,
})
export class Demo {}

Versioned docs (@ferrlabs/ui-ng/docs)

Brand-agnostic versioned-documentation layout, shared across product sites. DocsLayoutComponent renders the docs grid only (sidebar + version switcher, scrollable main with prev/next pager, on-this-page TOC) and projects rendered markdown into a .ferr-prose article via <ng-content>. It is shell-free — wrap it in your own product shell. The nav, versions, language, and URL segment are inputs, so the content stays in the consumer; only the structure ships here.

import { DocsLayoutComponent, DocSection, DocVersion } from '@ferrlabs/ui-ng/docs';

const NAV: readonly DocSection[] = [
  { label: 'Getting started', items: [{ label: 'Introduction', slug: 'introduction' }] },
];
const VERSIONS: readonly DocVersion[] = [{ slug: 'current', label: 'v5' }];

@Component({
  imports: [DocsLayoutComponent],
  template: `
    <flr-docs-layout [nav]="nav" [versions]="versions" slug="introduction" lang="en">
      <!-- rendered markdown -->
    </flr-docs-layout>
  `,
})
export class DocsPage {
  protected readonly nav = NAV;
  protected readonly versions = VERSIONS;
}

Import the markdown-content stylesheet once (it styles .ferr-prose, .ferr-aside, .ferr-card, .ferr-tabs — all CSS-var driven):

@import '@ferrlabs/ui-ng/docs/styles.css';

Markdown and code (@ferrlabs/ui-ng/markdown)

Syntax-highlighted code and sanitized GFM rendering, in a secondary entry point so the main entry stays free of these dependencies. Install the optional peers only if you import it:

pnpm add marked marked-highlight prismjs
import { CodeComponent, MarkdownComponent } from '@ferrlabs/ui-ng/markdown';
<flr-code [code]="snippet" language="rust" /> <flr-markdown [source]="report" />
  • flr-code: inputs code (required) and language. Unknown or missing languages render as escaped plain text. The header shows the language and a copy button.
  • flr-markdown: input source. Renders GFM (tables, task lists, strikethrough), highlights fenced code, and passes the result through Angular's [innerHTML] sanitizer, so scripts and event handlers in the source are stripped. Links get rel="noopener noreferrer".
  • Languages: javascript, typescript, json, bash, rust, python, yaml, toml, sql, diff, markdown, css, markup (html/xml), go, docker. Common aliases (ts, sh, yml, rs, html, ...) resolve.
  • Theming: --color-code-* tokens from @ferrlabs/ui-foundation (bg, fg, comment, keyword, string, number, function, operator, punctuation, property, inserted, deleted), with light and dark values. No stylesheet import is needed; styles ship with the components (ViewEncapsulation.None, scoped by the .flr-code and .flr-markdown host classes so the rendered HTML can be styled).

Conventions

  • Standalone components, no NgModules.
  • Signal inputs (input()) and signal outputs (output()).
  • ChangeDetectionStrategy.OnPush everywhere (the app runs zoneless).
  • Selectors are prefixed flr-.
  • Build: pnpm --filter @ferrlabs/ui-ng build (ng-packagr → Angular Package Format).

License

Licensed under either of Apache-2.0 or MIT, at your option.

版本与发布记录

@ferrlabs/ui-ng 共发布 29 个版本,首次发布于 2026/09/27;过去 12 个月发布了 29 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.51.0latest2026/11/14今天
1.50.12026/11/122 天前
1.50.02026/11/113 天前
1.49.02026/11/113 天前
1.48.02026/11/113 天前
1.47.22026/11/113 天前

关于 @ferrlabs/ui-ng 的常见问题

@ferrlabs/ui-ng 是什么?

FerrLabs design system: Angular 22 components (standalone, signals, zoneless), themed by the tokens of @ferrlabs/ui-foundation.

如何安装 @ferrlabs/ui-ng?

在项目目录运行 npm install @ferrlabs/ui-ng,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/cdk(^22.0.0)、@angular/core(^22.0.0)、@angular/forms(^22.0.0)、@angular/common(^22.0.0)、@angular/platform-browser(^22.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ferrlabs/ui-ng 支持 TypeScript 吗?

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

@ferrlabs/ui-ng 支持 ESM 还是 CommonJS?

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

@ferrlabs/ui-ng 可以商用吗?

@ferrlabs/ui-ng 使用 MIT OR Apache-2.0 许可。可在 MIT、Apache-2.0 中任选其一遵守。选择 MIT 时,宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ferrlabs/ui-ng 的下载量有多少?

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

@ferrlabs/ui-ng 还在维护吗?

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