@cleartrip/ct-design-stepper

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

Stepper Component

原始使用文档
文档目录11 节
  1. Installation
  2. Peer dependencies
  3. Usage
  4. As a progress tracker
  5. As a static list
  6. With sub-steps
  7. Props
  8. IStepperStep
  9. StepStatus
  10. StepLevel
  11. Accessibility

Stepper

A vertical stepper that renders a list of steps with an optional level of sub-steps. It can act as a progress tracker, where completed steps carry a tick and upcoming steps are muted, or as a static list of steps for explaining a flow.


Installation

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

Peer dependencies

# Required for all targets
npm install react

# Web only
npm install react-dom

# React Native only
npm install react-native

Usage

As a progress tracker

activeStep marks the step in focus; every step before workflowStep renders as completed.

import { Stepper } from '@cleartrip/ct-design-stepper';

function Example() {
  return (
    <Stepper
      steps={[{ label: 'Request booking' }, { label: 'Approval' }, { label: 'Book' }]}
      activeStep={1}
      workflowStep={1}
    />
  );
}

As a static list

isStatic renders every step with the same neutral treatment and ignores the progress indices, for cases where the steps explain a flow rather than track one.

<Stepper
  isStatic
  steps={[
    { label: 'Request booking', subtitle: 'Pick a hotel and raise a request' },
    { label: 'Approval', subtitle: 'Your approver reviews the request' },
    { label: 'Book', subtitle: 'Complete the booking once approved' },
  ]}
/>

With sub-steps

Sub-steps expand only under the step that is currently active.

<Stepper
  steps={[
    { label: 'Traveller details' },
    {
      label: 'Payment',
      hasChildren: true,
      subSteps: [{ label: 'Select mode' }, { label: 'Confirm' }],
    },
  ]}
  activeStep={1}
  workflowStep={1}
  activeSubStep={0}
  workflowSubStep={0}
/>

Props

PropTypeDefaultRequiredDescription
stepsIStepperStep[][]✅ YesThe steps to render, top to bottom.
activeStepnumber0NoIndex of the step in focus.
activeSubStepnumber0NoIndex of the sub-step in focus within the active step.
workflowStepnumber0NoSteps before this index render as completed.
workflowSubStepnumber0NoSub-steps before this index render as completed.
isStaticbooleanfalseNoRenders every step neutral and ignores the progress indices.
styleConfigIStepperStyleConfig{}NoStyle overrides for the root, rows, icons, labels and vertical line.

IStepperStep

FieldTypeRequiredDescription
labelstring✅ YesThe step label.
subtitlestringNoSecondary line rendered under the label.
hasChildrenbooleanNoWhether the step expands into sub-steps when active.
subStepsIStepperSubStep[]NoThe sub-steps, rendered only while the step is active.
onClick() => voidNoFired when the step's icon or label is pressed.

StepStatus

  • DONE — completed: solid green circle with a tick
  • CURRENT — in focus: outlined circle with an emphasised label
  • PENDING — upcoming: muted circle and label
  • NEUTRAL — no progress relationship, used by isStatic

StepLevel

  • OUTER — a top-level step
  • INNER — a sub-step

Accessibility

  • The component follows accessibility best practices
  • Ensure proper ARIA attributes are provided where needed
  • Test with screen readers to ensure usability

版本与发布记录

@cleartrip/ct-design-stepper 共发布 780 个版本,首次发布于 2023/11/06;过去 12 个月发布了 365 个版本。

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

其他发布通道:SNAPSHOT-CAROUSEL → 2.1.1-SNAPSHOT-CAROUSEL.0,SNAPSHOT-ITINERARY-OTP-CAROUSEL → 2.2.0-SNAPSHOT-ITINERARY-OTP-CAROUSEL.2,SNAPSHOT-ITINERARY → 2.2.0-SNAPSHOT-ITINERARY.2,SNAPSHOT-ITINERARY-OUTSIDECLICK → 2.2.0-SNAPSHOT-ITINERARY-OUTSIDECLICK.2,SNAPSHOT-SPINNER → 2.1.1-SNAPSHOT-SPINNER.0,SNAPSHOT-DRAWERV2 → 2.3.0-SNAPSHOT-DRAWERV2.0。

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

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

Stepper Component

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

在项目目录运行 npm install @cleartrip/ct-design-stepper,或使用 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-stepper 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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