Steps

A sequence of steps that shows progress through a flow.

VerifiedSince 0.3.4

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 completed or error status explicitly.
  • Disable steps that depend on unfinished prerequisites.
  • Keep the authoritative flow state in the parent; TxSteps is 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

PropTypeDefaultDescription
activenumber | string0Active 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

SlotPropsDescription
default-TxStep children.

TxStep

Props

PropTypeDefaultDescription
titlestring-Step title.
descriptionstring-Supporting text.
iconstring-Icon name or class shown before completion.
status'wait' | 'active' | 'completed' | 'error''wait'Manual status; the active state and numeric completion take precedence.
stepnumber | stringchild orderStep key; defaults to the zero-based child order. String keys are numbered by order.
clickablebooleantrueRenders a button head; a click updates the internal active step.
disabledbooleanfalseDisables the step button and blocks activation.
showLinebooleantrueRenders the connector; the last step never has one.
completedIconstring'check'Icon shown in the completed state.

Overview

  • TxSteps is role="list" and each TxStep is role="listitem"; the active step's head has aria-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 active count as completed; string keys need status="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