Back to Ant Design

Steps

components/steps/index.zh-CN.md

6.3.74.7 KB
Original Source

何时使用 {#when-to-use}

当任务复杂或者存在先后关系时,将其分解成一系列步骤,从而简化任务。

代码演示 {#examples}

<!-- prettier-ignore -->

<code src="./demo/simple.tsx">基本用法</code> <code src="./demo/error.tsx">步骤运行错误</code> <code src="./demo/vertical.tsx">竖直方向的步骤条</code> <code src="./demo/clickable.tsx">可点击</code> <code src="./demo/panel.tsx">面板式步骤</code> <code src="./demo/icon.tsx">带图标的步骤条</code> <code src="./demo/step-next.tsx" debug>步骤切换</code> <code src="./demo/title-placement.tsx">标签放置位置与进度</code> <code src="./demo/progress-dot.tsx">点状步骤条</code> <code src="./demo/customized-progress-dot.tsx" debug>自定义点状步骤条</code> <code src="./demo/nav.tsx">导航步骤</code> <code src="./demo/progress.tsx" debug>带有进度的步骤</code> <code src="./demo/progress-debug.tsx" debug>Progress Debug</code> <code src="./demo/steps-in-steps.tsx" debug>Steps 嵌套 Steps</code> <code src="./demo/inline.tsx">内联步骤</code> <code src="./demo/inline-variant.tsx">内联样式组合</code> <code src="./demo/variant-debug.tsx" debug>变体 Debug</code> <code src="./demo/component-token.tsx" debug>组件 Token</code> <code src="./demo/style-class.tsx" version="6.0.0">自定义语义结构的样式和类</code>

API

通用属性参考:通用属性

Steps

整体步骤条。

参数说明类型默认值版本
classNames用于自定义组件内部各语义化结构的 class,支持对象或函数Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-
current指定当前步骤,从 0 开始记数。在子 Step 元素中,可以通过 status 属性覆盖状态number0
direction指定步骤条方向。目前支持水平(horizontal)和竖直(vertical)两种方向stringhorizontal
iconRender自定义渲染图标,请优先使用 items.icon(oriNode, info: { index, active, item }) => ReactNode-
initial起始序号,从 0 开始记数number0
labelPlacement指定标签放置位置,默认水平放图标右侧,可选 vertical 放图标下方stringhorizontal
orientation指定步骤条方向。目前支持水平(horizontal)和竖直(vertical)两种方向stringhorizontal
percent当前 process 步骤显示的进度条进度(只对基本类型的 Steps 生效)number-4.5.0
progressDot点状步骤条,可以设置为一个 function,请使用 type="dot" 替代。titlePlacement 将强制为 verticalboolean | (iconDot, { index, status, title, content }) => ReactNodefalse
responsive当屏幕宽度小于 532px 时自动变为垂直模式booleantrue
size指定大小,目前支持普通(medium)和迷你(smallstringmedium
status指定当前步骤的状态,可选 wait process finish errorstringprocess
styles用于自定义组件内部各语义化结构的行内 style,支持对象或函数Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-
titlePlacement指定标签放置位置,默认水平放图标右侧,可选 vertical 放图标下方stringhorizontal
type步骤条类型,可选 default dot inline navigation panelstringdefault
variant设置样式变体filled | outlinedfilled
onChange点击切换步骤时触发(current) => void-
items配置选项卡内容StepItem[]4.24.0

StepItem

步骤条内的每一个步骤。

参数说明类型默认值版本
content步骤的详情描述,可选ReactNode-
description步骤的详情描述,可选ReactNode-
disabled禁用点击booleanfalse
icon步骤图标的类型,可选ReactNode-
status指定状态。当不配置该属性时,会使用 Steps 的 current 来自动指定状态。可选:wait process finish errorstringwait
subTitle子标题ReactNode-
title标题ReactNode-

Semantic DOM

Steps

<code src="./demo/_semantic.tsx" simplify="true"></code>

StepItem

<code src="./demo/_semantic_items.tsx" simplify="true"></code>

主题变量(Design Token){#design-token}

<ComponentTokenTable component="Steps"></ComponentTokenTable>