Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

FlowProgress

Progress bar for multi-step transaction flows. Automatically connects to TransactionButton through TxKitProvider context.

Quick Start

import { TransactionButton, FlowProgress, txStep } from '@txkit/react'
 
<FlowProgress />
<TransactionButton
  steps={[
    txStep('approve', 'Approve', approveTx),
    txStep('swap', 'Swap', swapTx),
  ]}
/>

Three Tiers of Customization

Tier 1: Zero-Config

<FlowProgress />

Tier 2: Custom Render

<FlowProgress>
  {({ progress, status, currentStepLabel }) => (
    <div>
      <div style={{ width: `${progress * 100}%`, height: 4, background: 'var(--tx-color-primary, #4338CA)' }} />
      <span>{currentStepLabel} - {Math.round(progress * 100)}%</span>
    </div>
  )}
</FlowProgress>

Props

PropTypeDefaultDescription
classNamestring-CSS class
children(data: RenderData) => ReactNode-Custom render function
data-testidstring-Test ID for automated testing
flowIdstring'__default__'Flow ID to display
showSummarybooleanfalseShow "Overall Progress - X%" row above the bar
summaryLabelstring'Overall Progress'Custom label for the summary row

Render Data

type FlowProgressRenderData = {
  progress: number              // 0 to 1
  status: FlowStatus
  currentStepLabel: string | undefined
}

Status Reference

FlowProgress reflects the current FlowStatus of the registered flow.

StatusMeaning
idleNo flow started
simulating-allPre-flight simulation across all steps
runningA step is currently executing
pausedUser paused mid-flow
completedAll steps succeeded
errorA step threw an unexpected error
rejectedUser rejected a wallet popup
canceledUser canceled the flow before completion

The root element exposes data-status="<FlowStatus>" for CSS theming.

Progress Calculation

Progress is calculated as completedSteps / totalSteps. Skipped steps count as completed (already-fulfilled prerequisites). Failed steps stop progress at the failed step's index. Canceled flows render with a neutral grey bar via data-status="canceled".