Skip to content
API 风格:

Steps ​

Process step indicator with wait/process/finish/error states, horizontal/vertical directions and optional clickable navigation. Horizontal steps wrap at a fixed basis width, and titles always stay on a single line.

Basic Usage ​

Basic Usage
  1. Grind
  2. Paint
  3. Seal
vue
<script setup lang="ts">
</script>

<template>
  <LhSteps :current="1">
    <LhStep title="Grind" />
    <LhStep title="Paint" />
    <LhStep title="Seal" />
  </LhSteps>
</template>
vue
<script>
export default {}
</script>

<template>
  <LhSteps :current="1">
    <LhStep title="Grind" />
    <LhStep title="Paint" />
    <LhStep title="Seal" />
  </LhSteps>
</template>

With Descriptions ​

With Descriptions
  1. Register
    Fill in the basics
  2. Verify
    Email and phone
  3. Activate
    Grant permissions
vue
<script setup lang="ts">
</script>

<template>
  <LhSteps :current="1">
    <LhStep title="Register" description="Fill in the basics" />
    <LhStep title="Verify" description="Email and phone" />
    <LhStep title="Activate" description="Grant permissions" />
  </LhSteps>
</template>
vue
<script>
export default {}
</script>

<template>
  <LhSteps :current="1">
    <LhStep title="Register" description="Fill in the basics" />
    <LhStep title="Verify" description="Email and phone" />
    <LhStep title="Activate" description="Grant permissions" />
  </LhSteps>
</template>

The icon prop sets a custom icon per step (a built-in LhIcon name such as user/check/star); without it, finished/error steps show a check/cross and the rest show their index. Use the #icon slot to fully customize the icon rendering.

Custom icons
  1. Register
  2. Verify
  3. Activate
vue
<script setup lang="ts">
</script>

<template>
  <LhSteps :current="1">
    <LhStep icon="user" title="Register" />
    <LhStep icon="check" title="Verify" />
    <LhStep icon="star" title="Activate" />
  </LhSteps>
</template>
vue
<script>
export default {}
</script>

<template>
  <LhSteps :current="1">
    <LhStep icon="user" title="Register" />
    <LhStep icon="check" title="Verify" />
    <LhStep icon="star" title="Activate" />
  </LhSteps>
</template>

Error Status ​

Error Status
  1. Upload
  2. Validate
  3. Finish
vue
<script setup lang="ts">
</script>

<template>
  <LhSteps :current="1" status="error">
    <LhStep title="Upload" />
    <LhStep title="Validate" />
    <LhStep title="Finish" />
  </LhSteps>
</template>
vue
<script>
export default {}
</script>

<template>
  <LhSteps :current="1" status="error">
    <LhStep title="Upload" />
    <LhStep title="Validate" />
    <LhStep title="Finish" />
  </LhSteps>
</template>

status overrides every step globally — handy for custom presentations.

Clickable Navigation ​

Clickable Navigation
  1. Pick
    Choose a model
  2. Trace
    Trace or recall
  3. Mount
    Mount the work

Current step: 1

vue
<script setup lang="ts">
import { ref } from 'vue'
const current = ref(1)
</script>

<template>
  <LhSteps v-model:current="current" clickable>
    <LhStep title="Pick" description="Choose a model" />
    <LhStep title="Trace" description="Trace or recall" />
    <LhStep title="Mount" description="Mount the work" />
  </LhSteps>
</template>
vue
<script>
export default {
  data() {
    return { current: 1 }
  },
}
</script>

<template>
  <LhSteps v-model:current="current" clickable>
    <LhStep title="Pick" description="Choose a model" />
    <LhStep title="Trace" description="Trace or recall" />
    <LhStep title="Mount" description="Mount the work" />
  </LhSteps>
</template>

Vertical Direction ​

Vertical Direction
  1. Start
    Hidden tip
  2. Move
    Centered stroke
  3. Rest
    Return the brush
vue
<script setup lang="ts">
</script>

<template>
  <LhSteps :current="1" direction="vertical">
    <LhStep title="Start" description="Hidden tip" />
    <LhStep title="Move" description="Centered stroke" />
    <LhStep title="Rest" description="Return the brush" />
  </LhSteps>
</template>
vue
<script>
export default {}
</script>

<template>
  <LhSteps :current="1" direction="vertical">
    <LhStep title="Start" description="Hidden tip" />
    <LhStep title="Move" description="Centered stroke" />
    <LhStep title="Rest" description="Return the brush" />
  </LhSteps>
</template>

Fixed-Width Wrapping ​

Horizontal steps are laid out at the --lh-steps-item-basis basis width (default 160px): when they fit, the steps share one row evenly; when they do not, whole steps wrap to the next line instead of breaking the title. Titles are always single-line and truncate with an ellipsis when too long. After wrapping, the connector of the last step on each line is hidden so it does not point into empty space.

Fixed-Width Wrapping
  1. Pick
    Choose a model
  2. Trace
    Trace or recall
  3. Inscribe
    Sign and seal
  4. Mount
    Mount the work
vue
<script setup lang="ts">
</script>

<template>
  <LhSteps :current="1">
    <LhStep title="Pick" description="Choose a model" />
    <LhStep title="Trace" description="Trace or recall" />
    <LhStep title="Inscribe" description="Sign and seal" />
    <LhStep title="Mount" description="Mount the work" />
  </LhSteps>
</template>
vue
<script>
export default {}
</script>

<template>
  <LhSteps :current="1">
    <LhStep title="Pick" description="Choose a model" />
    <LhStep title="Trace" description="Trace or recall" />
    <LhStep title="Inscribe" description="Sign and seal" />
    <LhStep title="Mount" description="Mount the work" />
  </LhSteps>
</template>

The demo above is constrained to 280px to show the wrapping. To change the wrapping rhythm, override steps-item-basis via themeVars (the --lh- prefix is added automatically): <LhSteps :theme-vars="{ 'steps-item-basis': '220px' }">, or configure it globally through LhConfigProvider's componentTheme.steps.

Steps API ​

LhSteps Props ​

PropDescriptionTypeDefault
currentCurrent step index (v-model:current, 0-based)number0
directionDirection"horizontal" | "vertical"'horizontal'
clickableWhether steps can be clicked for navigationbooleanfalse
statusOverrides the status of all steps globally (for custom presentations)"wait" | "process" | "finish" | "error"—
themeVarsComponent-level theme variables (keys get the --lh- prefix automatically){ [x: string]: string; }—
sxQuick layout propsLhSxProps—

LhSteps Events ​

EventDescriptionCallback
update:currentCurrent step changed (v-model)(index: number)
changeCurrent step changed(index: number)

LhStep Props ​

PropDescriptionTypeDefault
titleStep title (or the title slot)string''
descriptionStep description (or the description slot)string''
iconCustom icon name (a built-in LhIcon name; defaults to check/cross for finish/error, otherwise the index)LhIconName—

Slots ​

SlotDescriptionComponent
defaultStep items (LhStep list)LhSteps
titleCustom titleLhStep
descriptionCustom descriptionLhStep
iconCustom icon (overrides the icon prop's default rendering)LhStep
descriptionCustom descriptionLhStep

Component Variables ​

The following CSS variables are defined with defaults on .lh-steps and can be overridden globally or per component via themeVars (keys get the --lh- prefix automatically):

VariableDescriptionDefault
--lh-steps-item-basisBasis width of each horizontal step; steps wrap at this width when they no longer fit160px

Accessibility ​

  • The container is <ol role="list">; semantic order matches the process order
  • The current step automatically gets aria-current="step"
  • With clickable, the head of finished/current steps is a real <button> whose aria-label comes from the locale (steps.finish / steps.error / steps.step); waiting steps are not clickable so users are not invited to skip ahead
  • Connectors are drawn with pseudo-elements and never enter the accessibility tree

Type Definitions ​

The TypeScript type structures exported by this component (auto-extracted from packages/components/steps/src/types.ts and @lh-ui/share/core/* sources; click each entry to expand; see the Props table above for attribute descriptions):

LhStepsProps
ts
export interface LhStepsProps {
  current?: number
  direction?: LhStepsDirection
  clickable?: boolean
  status?: LhStepStatus
  themeVars?: Record<string, string>
  sx?: LhSxProps
}
LhStepProps
ts
export interface LhStepProps {
  title?: string
  description?: string
  icon?: LhIconName
}
LhIconName (from @lh-ui/share/core/icon (svgs.ts))
ts
export type LhIconName = keyof typeof LH_ICON_SVGS_CONST
LhStepsDirection (from @lh-ui/share/core/steps)
ts
export type LhStepsDirection = 'horizontal' | 'vertical'
LhStepStatus (from @lh-ui/share/core/steps)
ts
export type LhStepStatus = 'wait' | 'process' | 'finish' | 'error'

Beauty of tradition, foundation of code