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

FlowToast

Toast notification for transaction flow events (success, error, step completion). Renders via portal, automatically connects to TransactionButton through TxKitProvider context.

Quick Start

import { TransactionButton, FlowToast, txStep } from '@txkit/react'
 
<TransactionButton
  steps={[ txStep('send', 'Send', { to: '0x...', value: parseEther('1') }) ]}
/>
<FlowToast position="bottom-right" />

Three Tiers of Customization

Tier 1: Zero-Config

<FlowToast />

Tier 2: Custom Render

<FlowToast>
  {({ visible, message, type, dismiss }) => (
    visible && (
      <div className={`toast toast-${type}`}>
        <span>{message}</span>
        <button onClick={dismiss}>x</button>
      </div>
    )
  )}
</FlowToast>

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
autoDismissnumber5000Auto-dismiss in ms (0 = manual)
position'top-right' | 'top-left' | 'bottom-right' | 'bottom-left''bottom-right'Toast position

Render Data

type FlowToastRenderData = {
  visible: boolean
  message: string
  description?: string
  type: 'success' | 'error' | 'info' | 'warning'
  stepId: string | undefined
  dismiss: () => void
}

Toast Types & Triggers

TypeTriggered when
successFlowStatus becomes completed
errorFlowStatus becomes error (unexpected error during execution)
warningFlowStatus becomes rejected (user rejected wallet popup)
infoFlowStatus becomes canceled (user canceled flow) - neutral copy

Toasts auto-dismiss after autoDismiss ms (default: 5000). Pass autoDismiss={0} to keep them open until explicitly dismissed.

Portal Placement

<FlowToast /> renders into a portal mounted on document.body. Pass position to control the corner: top-right, top-left, bottom-right (default), or bottom-left.