@entur/typography

中文文档
3.2.0发布于 2026/11/02SEE LICENSE IN README.mdTypeScriptESM + CJS近 30 天下载 3.6万

Entur的官方字体为Nationale,由位于哥本哈根的Playtype Foundry所创建. 该字体受许可证保护,只能用于官方Entur产品. 通过下载此字体, 您确认您受雇于 Entur and Th

中文使用文档
文档目录14 节
  1. 使用前读取
  2. 安装
  3. QQ 快速启动
  4. 使用稳定打字法(建议生产)
  5. 使用 Beta 图案( 实验特性)
  6. * 移徙
  7. 后向兼容性
  8. 现代进口(建议)
  9. 移动到新打字机
  10. 更新样式
  11. * 特性
  12. Β 类型
  13. 传统类型
  14. 许可证

类型

使用前读取

Entur的官方字体为Nationale,由位于哥本哈根的Playtype Foundry所创建. 该字体受许可证保护,只能用于官方Entur产品. 通过下载此字体, 您确认您为 Entur 所使用, 而该字体将只用于开发 Entur 的官方产品 . 所有其他用途都将被视为违反许可协议和Entur品牌,并可提起法律诉讼.

这个软件包包含样式和回放组件,用于我们所有的打字.

寻找 文档? 吗? 寻找β 文档? 吗?

安装

npm install @entur/typography
# or
yarn add @entur/typography

QQ 快速启动

import { Heading1, Paragraph, Link } from '@entur/typography';
import '@entur/typography/styles';

function MyComponent() {
  return (
    <div>
      <Heading1>My Title</Heading1>
      <Paragraph>My content</Paragraph>
      <Link href="/more">Learn more</Link>
    </div>
  );
}

使用 Beta 图案( 实验特性)

import { Heading, Text, Link } from '@entur/typography/beta';
import '@entur/typography/styles';
import '@entur/typography/beta/styles';

function MyComponent() {
  return (
    <div>
      <Heading as="h1" variant="title-1">
        My Title
      </Heading>
      <Text variant="paragraph">My content</Text>
      <Link href="/more">Learn more</Link>
    </div>
  );
}

* 移徙

有好消息吗! 这个软件包保持了完全后向相容性. 所有现有的进口模式仍然与以前一样有效.

后向兼容性

// ✅ All these still work exactly as before
import { Heading1 } from '@entur/typography/dist/Heading1';
import { Paragraph } from '@entur/typography/dist/Paragraph';
import '@entur/typography/dist/styles.css';
// 🚀 But these are now preferred
import { Heading1, Paragraph } from '@entur/typography';
import '@entur/typography/styles';

移动到新打字机

使用 migrate-typography 与您的 AI 编码代理。 它涵盖旧的部件(Heading1– 说吧 –6, (中文(简体) ), Paragraph ...),β变化和布局β间距尺度.

更新样式

// Replace this
@import '@entur/typography/dist/styles.css';

// With this
@import '@entur/typography/styles';

* 特性

Β 类型

  • 语义变体 - 标题、字幕、段落等.
  • 大小变体 - 特别大、大、中、小、多
  • 重量变量 - 中和大胆
  • 默认无边距 - 无论你放在哪里,文本都会被冲走
  • 间距 - 说吧 spacing="m" 或者说 spacing={{ top: 's', bottom: 'xl' }},与 gap 内 @entur/layout/beta
  • 文本连接器 - 环绕正在运行的文本,以获得标题、段落和列表之间的节奏
  • 无障碍 - 内建的ARIA支持和语义HTML

传统类型

  • 单个构成部分 - 标题1-6、段落、链接等.
  • 简单 API - 易于使用,配置最小
  • 后向兼容性 - 现行守则继续有效

许可证

  • 源代码根据欧洲联盟公共许可证第1.2版(欧盟PL-1.2)获得许可
  • 字体单独许可使用,所有使用均应遵循其许可使用.

版本与发布记录

@entur/typography 共发布 223 个版本,首次发布于 2019/09/25;过去 12 个月发布了 33 个版本。

版本发布日期距今
3.2.0latest2026/11/0211 天前
3.1.02026/10/2915 天前
3.0.72026/09/181 个月前
3.0.62026/09/171 个月前
3.0.52026/09/082 个月前
3.0.42026/08/282 个月前

其他发布通道:next → 3.0.0-next.2,beta → 3.0.2-beta.0。

关于 @entur/typography 的常见问题

@entur/typography 是什么?

Entur的官方字体为Nationale,由位于哥本哈根的Playtype Foundry所创建. 该字体受许可证保护,只能用于官方Entur产品. 通过下载此字体, 您确认您受雇于 Entur and Th

如何安装 @entur/typography?

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

@entur/typography 支持 TypeScript 吗?

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

@entur/typography 支持 ESM 还是 CommonJS?

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

@entur/typography 可以商用吗?

@entur/typography 使用 SEE LICENSE IN README.md 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@entur/typography 的下载量有多少?

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

@entur/typography 还在维护吗?

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