Steps
A sequence of steps that shows progress through a flow.
Usage
Numeric and String Keys
Numeric keys infer completed steps from active; string keys need an explicit status.
Loading demo...
Best Practices
- Use numeric keys for linear forms and onboarding so completion is inferred.
- Use string keys for named workflows, and set
completedorerrorstatus explicitly. - Disable steps that depend on unfinished prerequisites.
- Keep the authoritative flow state in the parent;
TxStepsis a progress cue, not the source of truth for a router or form. - Keep step descriptions short; put paragraphs or controls below the steps.
API Reference
TxSteps
Props
| Prop | Type | Default | Description |
|---|---|---|---|
active | number | string | 0 | Active step key; changes sync to the internal state. |
direction | 'horizontal' | 'vertical' | 'horizontal' | Layout direction. |
size | 'small' | 'medium' | 'large' | 'medium' | Size, passed down to child steps. |
Slots
| Slot | Props | Description |
|---|---|---|
default | - | TxStep children. |
TxStep
Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | - | Step title. |
description | string | - | Supporting text. |
icon | string | - | Icon name or class shown before completion. |
status | 'wait' | 'active' | 'completed' | 'error' | 'wait' | Manual status; the active state and numeric completion take precedence. |
step | number | string | child order | Step key; defaults to the zero-based child order. String keys are numbered by order. |
clickable | boolean | true | Renders a button head; a click updates the internal active step. |
disabled | boolean | false | Disables the step button and blocks activation. |
showLine | boolean | true | Renders the connector; the last step never has one. |
completedIcon | string | 'check' | Icon shown in the completed state. |
Overview
TxStepsisrole="list"and eachTxStepisrole="listitem"; the active step's head hasaria-current="step".- A clickable head is a native
<button type="button">, otherwise a<div>; a disabled step disables the button and ignores activation. - A click only updates the active step inside
TxSteps; nothing is emitted and the parent isn't updated. - Numeric keys before a numeric
activecount as completed; string keys needstatus="completed". - Without
step, a step registers in child order and uses its zero-based index as the key. - Under reduced motion, all motion stops and the state colors remain.
Technologies
- All motion is CSS: a completed marker swaps to a check, the connector sweeps to the next marker, and the new active marker pops in after it.
- Source:
packages/tuffex/packages/components/src/steps/.
查看源码
packages/tuffex/packages/components/src/steps/index.ts