Skip to content

Steps

Used to guide users through completing tasks in a process, or to show users the current step status.

Tip

wd-step now directly supports title, icon, and description slots. No need to set the old *-slot control fields.

Component Types

Basic Usage

active is the current step progress, corresponding to the step index.

html
<wd-steps :active="0">
  <wd-step />
  <wd-step />
  <wd-step />
</wd-steps>

Title and Description

Set the title and description for each step via title and description.

html
<wd-steps :active="active" align-center>
  <wd-step title="Step 1" description="Register an account" />
  <wd-step title="Step 2" description="Log in and bind phone" />
  <wd-step title="Step 3" description="Complete personal information" />
</wd-steps>
<wd-button size="small" @click="nextStep">Next Step</wd-button>
ts
const active = ref(0)

function nextStep() {
  active.value += 1
}

Custom Icon

Set the step icon via icon.

html
<wd-steps :active="1" align-center>
  <wd-step icon="settings" />
  <wd-step icon="list" />
  <wd-step icon="clock-circle" />
</wd-steps>

Component States

Modify Status

Set the status of a specific step via status.

html
<wd-steps :active="1" align-center>
  <wd-step title="Bind Phone" />
  <wd-step title="Rebind Phone" status="error" />
  <wd-step title="Step 3" />
</wd-steps>

Component Styles

Horizontal Center

Setting align-center centers horizontally. Only effective for horizontal step bars.

html
<wd-steps :active="0" align-center>
  <wd-step />
  <wd-step />
  <wd-step />
</wd-steps>

Layout Capabilities

Vertical Steps

Setting vertical displays in vertical direction.

html
<wd-steps :active="1" vertical>
  <wd-step description="Register an account" />
  <wd-step description="Log in and bind phone" />
  <wd-step description="Complete personal information" />
</wd-steps>

Special Styles

Dot Steps

Setting dot uses dot-style steps.

html
<wd-steps :active="1" align-center dot>
  <wd-step title="Step 1" description="Register an account" />
  <wd-step title="Step 2" description="Log in and bind phone" />
  <wd-step title="Step 3" description="Complete personal information" />
</wd-steps>

Controllable Dot Steps

Dot-style steps support controlling the current step via external active.

html
<wd-steps :active="dotActive" align-center dot>
  <wd-step title="Step 1" description="Register an account" />
  <wd-step title="Step 2" description="Log in and bind phone" />
  <wd-step title="Step 3" description="Complete personal information" />
</wd-steps>

Vertical Dot Steps

vertical and dot can be combined.

html
<wd-steps :active="1" vertical dot>
  <wd-step description="Register an account" />
  <wd-step description="Log in and bind phone" />
  <wd-step description="Complete personal information" />
</wd-steps>

Steps Attributes

ParameterDescriptionTypeDefault Value
activeCurrent active step indexnumber0
verticalWhether to display verticallybooleanfalse
dotWhether to use dot-style stepsbooleanfalse
spaceStep bar spacing, automatically calculated by defaultstring''
align-centerWhether to center horizontally, only effective for horizontal step barsbooleanfalse
custom-classRoot node custom class namestring''
custom-styleRoot node custom stylestring''

Step Attributes

ParameterDescriptionTypeDefault Value
titleStep title, displays default text when not passedstring-
descriptionStep descriptionstring-
iconStep iconstring-
statusStep status, optional values are finished, process, error, waitStepStatus-
custom-classRoot node custom class namestring''
custom-styleRoot node custom stylestring''

Steps Slots

nameDescription
defaultStep list

Step Slots

nameDescription
iconCustom step icon
titleCustom step title
descriptionCustom step description

主题定制

CSS 变量

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 全局配置

名称默认值描述
--wot-step-content-margin-top$spacing-super-tight内容区距头部的顶部外边距
--wot-step-vertical-content-margin-left$n-32垂直布局时内容区的左外边距
--wot-step-vertical-content-padding-bottom$n-20垂直布局时内容区的底部内边距
--wot-step-vertical-header-dot-top$n-6垂直布局且为点状指示器时,头部的顶部绝对定位距离
--wot-step-indicator-size$n-18圆形指示器的宽高尺寸
--wot-step-circle-border-radius$radius-radius-full圆形指示器的圆角大小
--wot-step-circle-bg$filled-strong等待 (wait) 状态下圆形指示器的背景色
--wot-step-process-bg$primary-6进行中 (process) 状态下圆形指示器的背景色
--wot-step-finished-bg$primary-1已完成 (finished) 状态下圆形指示器的背景色
--wot-step-error-bg$danger-main错误 (error) 状态下圆形指示器的背景色
--wot-step-circle-text-font-size$typography-label-size-main圆形指示器内部文本的字号
--wot-step-circle-text-line-height$typography-label-line--height-size-main圆形指示器内部文本的行高
--wot-step-circle-text-font-weight$font-weight-medium圆形指示器内部文本的字重
--wot-step-circle-text-color$text-secondary等待状态或默认状态下圆形指示器内文本颜色
--wot-step-circle-text-process-color$text-white进行中状态下圆形指示器内文本颜色
--wot-step-circle-text-finished-color$primary-6已完成状态下圆形指示器内文本颜色
--wot-step-circle-icon-size$n-12圆形指示器内置状态图标 (如完成时的对号或错误时的叉号) 的字号大小
--wot-step-icon-size$n-18外部自定义传入的图标 (通过 icon 属性) 的字号大小
--wot-step-icon-color$icon-auxiliary等待或默认状态下图标的颜色
--wot-step-icon-color-active$primary-6激活 (如 process 或 finished) 状态下图标的颜色
--wot-step-icon-error-color$danger-main错误 (error) 状态下图标的颜色
--wot-step-inactive-color$text-placeholder未激活部分的占位文本颜色
--wot-step-error-color$text-white错误状态整体的主色调(纯白文本场景下等使用)
--wot-step-line-spacing$spacing-tight连接线与两侧指示器之间的间距
--wot-step-line-color$border-main连接线的默认底色 (对应未激活的线段)
--wot-step-line-active-color$primary-6激活 (完成状态) 下连接线的颜色
--wot-step-dot-size$n-10点状指示器的宽高尺寸
--wot-step-dot-wait-bg$filled-strong等待 (wait) 状态下点状指示器的背景色
--wot-step-dot-process-bg$primary-6进行中 (process) 状态下点状指示器的背景色
--wot-step-dot-process-border-color$primary-3进行中 (process) 状态下点状指示器的描边颜色
--wot-step-dot-finished-bg$primary-3已完成 (finished) 状态下点状指示器的背景色
--wot-step-dot-finished-border-color$primary-6已完成 (finished) 状态下点状指示器的描边颜色
--wot-step-dot-error-bg$danger-main错误 (error) 状态下点状指示器的背景色
--wot-step-title-font-size$typography-body-size-main标题文本字号大小
--wot-step-title-line-height$typography-body-line--height-size-main标题文本行高
--wot-step-title-font-weight$font-weight-regular标题文本字重
--wot-step-title-color$text-secondary等待与完成状态下标题的颜色
--wot-step-title-color-active$primary-6进行中状态下标题的激活颜色
--wot-step-title-error-color$danger-main错误状态下标题的颜色
--wot-step-description-font-size$typography-label-size-main描述文本字号大小
--wot-step-description-line-height$typography-label-line--height-size-main描述文本行高
--wot-step-description-font-weight$font-weight-regular描述文本字重
--wot-step-description-color$text-secondary描述文本颜色
--wot-step-description-margin-top$spacing-super-tight描述文本距标题的距离
--wot-step-description-padding$padding-zero $padding-ultra-tight描述文本的内边距

Source Code

Documentation
Component

Released under the MIT License.

Released under the MIT License.