@cleartrip/ct-design-typography

中文文档
5.32.0发布于 2026/11/16ISCTypeScriptESM + CJS近 30 天下载 6.4万

Typography component with enhanced styleConfig support for RNW compatibility

原始使用文档
文档目录17 节
  1. Installation
  2. Peer dependencies
  3. Usage
  4. Basic
  5. Headings
  6. Body text
  7. Custom styling
  8. Props
  9. Variants
  10. Display (HD)
  11. Headings (HM)
  12. Body (B)
  13. Paragraphs (P)
  14. Labels (L)
  15. Special
  16. Colors
  17. Migration

Typography

Typography component provides consistent text styling across the design system with predefined variants and color schemes.


Installation

npm install @cleartrip/ct-design-typography
# or
pnpm add @cleartrip/ct-design-typography

Peer dependencies

# Required for all targets
npm install react

# Web only
npm install react-dom

# React Native only
npm install react-native

Usage

Basic

import { Typography, TypographyVariant, TypographyColor } from '@cleartrip/ct-design-typography';

function Example() {
  return (
    <Typography variant={TypographyVariant.B1} color={TypographyColor.PRIMARY}>
      This is sample typography text
    </Typography>
  );
}

Headings

<Typography variant={TypographyVariant.HD1} color={TypographyColor.HEADING}>
  Large Display Heading
</Typography>

<Typography variant={TypographyVariant.HM1} color={TypographyColor.HEADING}>
  Medium Heading
</Typography>

Body text

<Typography variant={TypographyVariant.B1} color={TypographyColor.PRIMARY}>
  Large body text for important content
</Typography>

<Typography variant={TypographyVariant.B2} color={TypographyColor.SECONDARY}>
  Regular body text with secondary color
</Typography>

Custom styling

<Typography
  variant={TypographyVariant.B1}
  color={TypographyColor.PRIMARY}
  styleConfig={{
    text: [{ fontWeight: 'bold', textDecoration: 'underline' }],
  }}
>
  Custom styled text
</Typography>

Props

PropTypeDefaultRequiredDescription
childrenReactNode—✅ YesThe content to be displayed within the typography element.
variantTypographyVariantType—✅ YesThe variant of the typography, such as 'h1', 'body1', etc.
colorTypographyColorType—NoThe color of the typography.
isUnderlinedboolean—NoIf true, adds an underline effect to the typography.
isStrikedboolean—NoIf true, adds a strikethrough effect to the typography.
isClickableboolean—NoIf true, makes the typography clickable.
onClick() => void—NoCallback function triggered on typography click.
colorCodestring—NoColor code to override the default color.
showInItalicsboolean—NoIf true, renders the typography in italics.
widthstring—NoThe width of the typography element.
lineClampnumber—NoThe number of lines to clamp the text. Ellipsis (...) is added for overflow.
isDisabledboolean—NoIf true, disables the typography for user interaction.
componentNodeTypographyNodeElementType—NoThe type of HTML element to be used for rendering the typography.
styleConfigTypographyStyleConfigProps—NoStyle configuration for the typography.

Variants

Display (HD)

  • HD1 — Extra large display text
  • HD2 — Large display text
  • HD3 — Medium display text

Headings (HM)

  • HM1 — Large heading
  • HM2 — Medium heading
  • HM3 — Small heading
  • HM4 — Extra small heading

Body (B)

  • B1 — Large body text
  • B2 — Regular body text
  • B3 — Small body text
  • B3CAPS — Small caps text
  • B4 — Extra small body text
  • B4CAPS — Extra small caps text

Paragraphs (P)

  • P1 — Large paragraph
  • P2 — Medium paragraph
  • P3 — Small paragraph

Labels (L)

  • L1 — Large label
  • L2 — Medium label
  • L3 — Small label

Special

  • OVERLINE — Overline text
  • TAG — Tag text
  • M4BOLD — Bold variant

Colors

  • PRIMARY — Primary text color
  • SECONDARY — Secondary text color
  • TERTIARY — Tertiary text color
  • HEADING — Heading color
  • SUBHEADING — Subheading color
  • SUCCESS — Success state color
  • ALERT — Alert/error state color
  • WARNING — Warning state color
  • DISABLED — Disabled state color
  • LINK — Link color
  • NEUTRAL — Neutral color
  • BRAND — Brand color

Migration

If migrating from previous versions:

- import { Typography } from 'yagami/core/components';
+ import { Typography, TypographyVariant, TypographyColor } from '@cleartrip/ct-design-typography';

版本与发布记录

@cleartrip/ct-design-typography 共发布 1,053 个版本,首次发布于 2023/10/25;过去 12 个月发布了 670 个版本。

版本发布日期距今
5.32.0latest2026/11/16今天
5.32.0-SNAPSHOT-5.32.0-SNAPSHOT-bs-height-check-161120161537.02026/11/16今天
5.32.0-SNAPSHOT-bs-height-check-151120162243.02026/11/16今天
3.34.0-SNAPSHOT-hdp-revamp-v3.02026/11/124 天前
3.34.0-SNAPSHOT-hdp-revamp-v2.02026/11/124 天前
5.32.0-SNAPSHOT-biztrip-rn-sme-snapshot-11-11-26.02026/11/115 天前

其他发布通道:SNAPSHOT-ITINERARY-OTP-CAROUSEL → 2.1.1-SNAPSHOT-ITINERARY-OTP-CAROUSEL.0,SNAPSHOT-ITINERARY → 2.1.1-SNAPSHOT-ITINERARY.0,SNAPSHOT-ITINERARY-OUTSIDECLICK → 2.1.1-SNAPSHOT-ITINERARY-OUTSIDECLICK.0,SNAPSHOT-DRAWERV2 → 2.3.0-SNAPSHOT-DRAWERV2.0,SNAPSHOT-ITINERARYFIX → 2.3.0-SNAPSHOT-ITINERARYFIX.0,SNAPSHOT-3DCAROUSEL → 2.3.1-SNAPSHOT-3DCAROUSEL.0。

关于 @cleartrip/ct-design-typography 的常见问题

@cleartrip/ct-design-typography 是什么?

Typography component with enhanced styleConfig support for RNW compatibility

如何安装 @cleartrip/ct-design-typography?

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

@cleartrip/ct-design-typography 支持 TypeScript 吗?

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

@cleartrip/ct-design-typography 支持 ESM 还是 CommonJS?

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

@cleartrip/ct-design-typography 可以商用吗?

@cleartrip/ct-design-typography 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cleartrip/ct-design-typography 的下载量有多少?

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

@cleartrip/ct-design-typography 还在维护吗?

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