Steps
Displays data-driven steps with controlled active state and horizontal or vertical layouts.
Import
Use <hui-steps> after configuring uni-app easycom. Import public types and functions from @nscode/handy-uni. Ordinary Vue applications install the @nscode/handy-uni/web preview plugin.
Examples
Each example is standalone. Controls show the current value or event result on the page.
<template>
<view>
<hui-space direction="vertical" fill>
<hui-steps
v-model:active="active"
custom-class="hui-space__item"
:items="items"
clickable
@change="onChange"
/>
<hui-steps
custom-class="hui-space__item"
:items="items"
:active="1"
direction="vertical"
dot
/>
<text class="hui-space__item">{{ active }} / {{ lastEvent }}</text>
</hui-space>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { StepsItem } from '@nscode/handy-uni'
const lastEvent = ref('尚无事件 / No event')
const active = ref(0)
const onChange = (index: number, context: { item: StepsItem }) => {
lastEvent.value = JSON.stringify({ index, item: context.item })
}
const items = [
{ title: '提交 / Submit' },
{ title: '审核 / Review', description: '等待 / Waiting' },
{ title: '完成 / Done', disabled: true }
]
</script>
Props
| Prop | Type | Default | Details |
|---|---|---|---|
items | StepsItem[] | [] | Data items rendered in source order. |
active | number | — | Controlled active step index, starting at 0. |
defaultActive | number | 0 | Initial active index for uncontrolled mode. |
direction | StepsDirection | 'horizontal' | Layout or scrolling direction. |
alignCenter | boolean | false | Centers horizontal step labels. |
finishStatus | StepsStatus | 'finish' | Status of completed steps. |
processStatus | StepsStatus | 'process' | Status of the current step. |
dot | boolean | false | Displays a dot indicator. |
clickable | boolean | false | Enables click or keyboard interaction. |
Root classes and styles use customClass and customStyle. Numbers representing dimensions use px; durations use ms unless explicitly documented.
Events
| Event | Arguments |
|---|---|
update:active | (index: number) |
change | (index: number, context: { item: StepsItem }) |
Controlled state only changes when the parent accepts its update event. Events with multiple words use kebab-case. Disabled or stale asynchronous actions do not emit a successful state change.
Slots
| Slot | Scope |
|---|---|
icon | { item, index, status } |
title | { item, index, status } |
description | { item, index, status } |
Methods
None.
Types
StepsDirection、StepsStatus、StepsItem、StepsProps、StepsEmits.
Platform notes
Supports H5, WeChat mini-program, App-vue and ordinary Vue 3 Web through shared platform components. Unit tests do not replace device acceptance; verify touch, screen readers, deactivation and native rendering on each target.
Device smoke checklist.