GitHub

MultiStepLoader

A step-based loading indicator with smooth transitions between steps.

Loading...

Basic Usage

import { MultiStepLoader } from "@corew500/ui"

const steps = [
  { label: "Connecting..." },
  { label: "Authenticating..." },
  { label: "Loading data..." },
  { label: "Complete!" },
]

<MultiStepLoader steps={steps} loading currentStep={1} />

Controlled Progress

const [currentStep, setCurrentStep] = useState(0)

<MultiStepLoader
  steps={steps}
  loading={isLoading}
  currentStep={currentStep}
  onComplete={() => console.log("Done!")}
/>

With Loop

Automatically restart from the beginning:

<MultiStepLoader steps={steps} loading loop />

Variants

// Default - shows all steps with progress
<MultiStepLoader variant="default" steps={steps} loading />

// Compact - smaller, inline display
<MultiStepLoader variant="compact" steps={steps} loading />

// Minimal - just the current step text
<MultiStepLoader variant="minimal" steps={steps} loading />

Custom Step Icons

const stepsWithIcons = [
  { label: "Uploading", icon: <Upload className="size-4" /> },
  { label: "Processing", icon: <Cog className="size-4" /> },
  { label: "Complete", icon: <Check className="size-4" /> },
]

<MultiStepLoader steps={stepsWithIcons} loading />

Props

PropTypeDefaultDescription
steps*LoaderStep[]Array of steps to display
currentStep*numberCurrent step index (0-based)
loadingenumtrueWhether the loader is active
loopenumfalseWhether to loop back to the first step after completing
onComplete() => voidCallback when all steps are completed
stepDurationnumberDuration to show each step when auto-advancing (ms)
variantenumdefault
sizeenumdefault

LoaderStep Type

interface LoaderStep {
  label: string
  icon?: React.ReactNode
}

Design Tokens

| Token | Description | |-------|-------------| | --loader-step-size | Step indicator size | | --loader-step-gap | Gap between steps | | --loader-transition-duration | Animation timing |