@entur/typography

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

Entur's official font is Nationale and is created by Playtype Foundry, located in Copenhagen. The font is protected under licence and shall only be used in official Entur products. By downloading this font you confirm that you are employed by Entur and th

原始使用文档
文档目录14 节
  1. Read before use
  2. Installation
  3. 🚀 Quick Start
  4. Using Stable Typography (Recommended for Production)
  5. Using Beta Typography (Experimental Features)
  6. 🔄 Migration
  7. Backward Compatibility
  8. Modern Imports (Recommended)
  9. Migrating to the new typography
  10. Update Styles
  11. 🎨 Features
  12. Beta Typography
  13. Legacy Typography
  14. Licenses

Typography

Read before use

Entur's official font is Nationale and is created by Playtype Foundry, located in Copenhagen. The font is protected under licence and shall only be used in official Entur products. By downloading this font you confirm that you are employed by Entur and that the font only will be used in developing official Entur products. All other uses will be regarded as a violation to the licence agreement and to Entur's brand, and legal actions may be filed.

This package contains styles and React components for all of our typography.

💡 Looking for the documentation? Looking for the beta documentation?

Installation

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

🚀 Quick Start

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>
  );
}

Using Beta Typography (Experimental Features)

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>
  );
}

🔄 Migration

Good news! This package maintains full backward compatibility. All existing import patterns continue to work exactly as before.

Backward Compatibility

// ✅ 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';

Migrating to the new typography

Use the migrate-typography skill with your AI coding agent. It covers the old components (Heading1–6, Paragraph …), the beta changes and the layout beta spacing scale.

Update Styles

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

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

🎨 Features

Beta Typography

  • Semantic variants - Title, subtitle, section, paragraph, etc.
  • Size variants - Extra large, large, medium, small, extra small
  • Weight variants - Medium and bold
  • No margins by default - Text sits flush wherever you place it
  • Spacing - spacing="m" or spacing={{ top: 's', bottom: 'xl' }}, on the same scale as gap in @entur/layout/beta
  • TextContainer - Wrap running text to get the rhythm between headings, paragraphs and lists
  • Accessibility - Built-in ARIA support and semantic HTML

Legacy Typography

  • Individual components - Heading1-6, Paragraph, Link, etc.
  • Simple API - Easy to use with minimal configuration
  • Backward compatibility - Existing code continues to work

Licenses

  • Source code is licensed under European Union Public License, version 1.2 (EUPL-1.2)
  • The fonts are licensed separately, and all use should follow its licence.

版本与发布记录

@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's official font is Nationale and is created by Playtype Foundry, located in Copenhagen. The font is protected under licence and shall only be used in official Entur products. By downloading this font you confirm that you are employed by 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 和提交记录判断。