Steps
Step-by-step progress indicator with horizontal/vertical layouts, numeric or string step keys, clickable heads, and explicit disabled states.
Usage
The common case uses numeric steps. Completed states are inferred when both active and step keys are numbers.
Loading demo...
Best Practices
- Use numeric keys for linear forms and onboarding flows where completion can be inferred.
- Use string keys for named workflows, but set
statusexplicitly for completed or error states. - Disable future steps when users must complete prerequisites before jumping ahead.
- Treat
TxStepsas progress/navigation affordance, not as the source of truth for a router or form state. Keep the authoritative workflow state in the parent. - Avoid putting long descriptions into every step; use step details below the component when content needs paragraphs or controls.
API Reference
TxSteps Props
| Prop | Type | Default | Description |
|---|---|---|---|
active | number | string | 0 | Active step key. Prop changes update the internal active step. |
direction | 'horizontal' | 'vertical' | 'horizontal' | Layout direction for the root and child steps. |
size | 'small' | 'medium' | 'large' | 'medium' | Visual scale forwarded to child steps. |
TxStep Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | - | Step title. |
description | string | - | Optional supporting copy. |
icon | string | - | Icon name/class used for non-completed custom icons. |
status | 'wait' | 'active' | 'completed' | 'error' | 'wait' | Manual status. The active state and numeric completion inference can override it. |
step | number | string | child order | Step key. When omitted, the zero-based child order is used. |
clickable | boolean | true | Renders a button head and lets clicks update the internal active step. |
disabled | boolean | false | Disables the step button and blocks activation. |
showLine | boolean | true | Controls connector rendering. The last step never renders a line. |
completedIcon | string | 'check' | Icon rendered when the resolved status is completed. |
Slots
| Component | Slot | Description |
|---|---|---|
TxSteps | default | TxStep children. |
Events
No events are emitted. Clickable steps update only the internal active step stored by TxSteps.
Overview
TxStepsrendersrole="list"; eachTxSteprendersrole="listitem".- Clickable step heads are native
button type="button"elements. Non-clickable heads render asdiv. - Disabled clickable steps render disabled buttons and ignore activation.
- Active steps expose
aria-current="step"on the head. - If
stepis omitted,TxStepregisters itself in child order and uses that zero-based index as its key. - Numeric steps before a numeric active step are treated as completed. String-keyed flows need explicit
status="completed"when you want completion styling. - Clicks update the internal active step but do not emit a change event or update the parent automatically.
Technologies
- State contract:
TxStepsowns an internalactiveStepand watches theactiveprop. Clicking a step changes only that internal value; noupdate:activeorchangeevent is emitted. - Ordering note: Steps register by component uid and child order. Numeric steps infer completed state from
effectiveStep < activeStep; string-valued flows need explicitstatus="completed"when completion should be shown. - Verified coverage:
steps.test.tscovers list/listitem semantics, automatic numeric completion, connector omission on the last item, explicit string steps, click-driven internal active state, and disabled/non-clickable blocking. - Component sources:
packages/tuffex/packages/components/src/steps/src/TxSteps.vueandTxStep.vue. - Types:
packages/tuffex/packages/components/src/steps/src/types.tsexportsStepsProps,StepProps,StepsDirection,StepsSize, andStepStatus. - Export entry:
packages/tuffex/packages/components/src/steps/index.tsre-exports fromsrc. - Coverage:
packages/tuffex/packages/components/src/steps/__tests__/steps.test.tsverifies ordering, active state, string steps, connector lines, click behavior, blocking states, and the connector geometry (each size sets only--tx-step-icon-sizeand the line reads it; the line is a sibling of the marker button and carriestx-step__line--completedafter a completed step). - Visual (2026-09-06): markers sit centred over their own titles and the connector runs from this marker's edge to the next one's (it used to be a flex sibling inside the button, which pushed every marker left of its title); steps ahead are a hollow ring with secondary text, completed and current steps share the primary hue (completed is no longer green) with a 4px halo on the current one, the connector after a completed step takes the same colour, and
errorhas a style of its own. - Motion (2026-09-06): all CSS, sequenced in reading order — the marker just completed swaps its number for the check (with a small overshoot), the connector after it sweeps towards the next marker (staggered 140ms per step on mount, so a fresh row draws its progress left to right), and the new current marker pops in behind the sweep and then keeps a slow breathing halo; stepping back eases the connector out through a transition rather than snapping.
prefers-reduced-motionturns all of it off and keeps the state colours.
查看源码
packages/tuffex/packages/components/src/steps/index.ts