Skip to main content
Version: Next

Stepper

Overview

The Stepper component helps visualize progress through a multi-step process. It's perfect for forms, wizards, or any sequential workflow in your application. The component includes support for completed states, active states, and optional descriptions for each step.

Preview

Details
Personal info
2
Address
Shipping info
3
Payment
Card details
4
Review
Final check

Installation

npx @mindfiredigital/ignix-ui add stepper

Usage

Import the component:

import { Stepper } from './components/ui';

Basic Usage

function BasicStepper() {
const [currentStep, setCurrentStep] = useState(0);

const steps = [
{ label: 'Step 1' },
{ label: 'Step 2' },
{ label: 'Step 3' },
];

return (
<Stepper
steps={steps}
activeStep={currentStep}
/>
);
}

Examples

Basic Stepper

Step 1
2
Step 2
3
Step 3

With Descriptions

Account
Create account
Profile
Complete profile
3
Verify
Verification
4
Done
Final step

Interactive Example

1
Cart
Review items
2
Shipping
Delivery info
3
Payment
Card details

Props

PropTypeDefaultDescription
stepsArray<{ label: string; description?: string; }>[]Array of step objects with labels and optional descriptions
activeStepnumber0Current active step (0-based index)
classNamestring-Additional CSS classes

Customization

Custom Styling

You can customize the appearance using Tailwind CSS classes:

<Stepper
className="max-w-2xl mx-auto"
steps={[
{ label: 'Start', description: 'Begin here' },
{ label: 'Middle', description: 'Continue' },
{ label: 'End', description: 'Complete' },
]}
activeStep={1}
/>

Form Integration Example

function StepperForm() {
const [currentStep, setCurrentStep] = useState(0);
const [formData, setFormData] = useState({
personal: {},
address: {},
payment: {},
});

const steps = [
{ label: 'Personal', description: 'Basic info' },
{ label: 'Address', description: 'Shipping details' },
{ label: 'Payment', description: 'Payment method' },
];

const renderStepContent = (step: number) => {
switch (step) {
case 0:
return <PersonalInfoForm data={formData.personal} onSave={handleSave} />;
case 1:
return <AddressForm data={formData.address} onSave={handleSave} />;
case 2:
return <PaymentForm data={formData.payment} onSave={handleSave} />;
default:
return null;
}
};

return (
<div className="space-y-6">
<Stepper steps={steps} activeStep={currentStep} />
<div className="mt-8">
{renderStepContent(currentStep)}
</div>
</div>
);
}