Skip to content

Steps - Vant 4

Steps

Intro

Used to show the various parts of the action flow and let the user know where the current action fits into the overall flow.

Install

Register component globally via app.use, refer to Component Registration for more registration ways.

js
import { createApp } from'vue'; import { Step, Steps } from'vant'; const app = createApp(); app.use(Step); app.use(Steps);

Usage

Basic Usage

html
js
import { ref } from'vue'; exportdefault { setup() { const active = ref(1); return { active }; }, };

Custom Style

html

Vertical Steps

html

API

Steps Props

AttributeDescriptionTypeDefault
activeActive step*numberstring*
directionCan be set to verticalstringhorizontal
active-colorActive step colorstring#1989fa

| inactive-color | Inactive step color | string | #969799 |

| active-icon | Active icon name | string | checked | | inactive-icon | Inactive icon name | string | - | | finish-icon | Finish icon name | string | - | | icon-prefix | Icon className prefix | string | van-icon |

Step Slots

NameDescription
defaultStep content
active-iconCustom active icon
inactive-iconCustom inactive icon
finish-iconCustom finish icon

Steps Events

EventDescriptionArguments
click-stepEmitted when a step's title or icon is clickedindex: number

Types

The component exports the following type definitions:

ts
importtype { StepsProps, StepsDirection } from'vant';

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

NameDefault ValueDescription
--van-step-text-colorvar(--van-text-color-2)-
--van-step-active-colorvar(--van-primary-color)-
--van-step-process-text-colorvar(--van-text-color)-
--van-step-font-sizevar(--van-font-size-md)-
--van-step-line-colorvar(--van-border-color)-
--van-step-finish-line-colorvar(--van-primary-color)-
--van-step-finish-text-colorvar(--van-text-color)-
--van-step-icon-size12px-
--van-step-circle-size5px-
--van-step-circle-colorvar(--van-gray-6)-
--van-step-horizontal-title-font-sizevar(--van-font-size-sm)-
--van-steps-backgroundvar(--van-background-2)-

Enterprise-level mobile solution based on Vant