Tuesday, July 7, 2026

lwc - Multi-Step Wizard

🧭 Multi-Step Wizard – Reusable Salesforce LWC

A reusable, slot-based Lightning Web Component that simplifies building multi-step forms with progress indicators, validation, navigation controls, review pages, and an imperative API—all using native Salesforce Lightning Web Components.

📖 Project Overview

Multi-Step Wizard is a production-ready Lightning Web Component that provides a complete wizard framework for Salesforce applications. Instead of building step navigation and validation logic repeatedly, developers simply define the steps and provide their own form fields while the component manages the workflow.

The wizard is completely domain-agnostic, making it suitable for any business process including record creation, onboarding, registration forms, approval workflows, surveys, checkout experiences, and guided configuration screens.

Built using native Lightning Web Components, the solution includes configurable progress indicators, automatic per-step validation, review pages, reusable step wrappers, and a clean JavaScript API for complete programmatic control.

✨ Key Features

Feature Description
Progress IndicatorSupports both Base (numbered) and Path (chevron) progress styles.
Step ValidationAutomatically validates inputs exposing reportValidity() before advancing.
Back & Next NavigationBuilt-in Previous, Next and Finish buttons.
Review StepCreate a final confirmation page before submission.
Slot-Based DesignEmbed any Lightning components or HTML inside wizard steps.
Imperative APIIncludes next(), previous(), goToStep(), reset() and reportValidity().
Custom EventsDispatches stepchange and complete events.
ReusableWorks with any Salesforce object or business process.

🏗 Component Architecture

Multi-Step Wizard — Reusable Lightning Web Component

📁 Project Structure

force-app/main/default/
│
├── classes
│   ├── WizardController.cls
│   └── WizardControllerTest.cls
│
└── lwc
    ├── multiStepWizard
    ├── wizardStep
    └── wizardDemo

⚙️ Component Attributes

Attribute Purpose
progress-typeChoose base or path progress indicator.
hide-progress-indicatorHide the step indicator.
hide-footerHide built-in navigation buttons.
allow-step-navigationAllow users to revisit completed steps.
previous-labelCustom Previous button text.
next-labelCustom Next button text.
finish-labelCustom Finish button text.

🛠 Imperative API

  • next() — Validate current step and move forward.
  • previous() — Navigate to the previous step.
  • goToStep(name) — Jump directly to a named step.
  • reset() — Reset the wizard to the first step.
  • reportValidity() — Trigger validation for the active step.

📡 Events

Event Description
stepchangeRaised whenever the active wizard step changes.
completeRaised after the user finishes the final step.

🔄 Wizard Flow

Start Wizard
      │
      ▼
Step 1
      │
Validate
      ▼
Step 2
      │
Validate
      ▼
Step 3
      │
      ▼
Review
      │
      ▼
Complete Event
      │
      ▼
Save Business Data

🎯 Business Use Cases

  • Customer Registration
  • Lead Qualification
  • Contact Creation
  • Employee Onboarding
  • Insurance Applications
  • Loan Processing
  • Case Intake Forms
  • Checkout & Payment Flows
  • Approval Processes
  • Survey Applications

🚀 Deployment

sf org login web --alias myOrg

sf project deploy start \
--source-dir force-app \
--target-org myOrg

sf apex run test \
--class-names WizardControllerTest

📌 Conclusion

The Multi-Step Wizard provides a clean, reusable foundation for creating guided user experiences in Salesforce. With configurable progress indicators, automatic validation, slot-based content, review screens, an imperative JavaScript API, and custom events, it enables developers to build scalable wizard-driven applications while keeping business logic separate from navigation and presentation.

No comments:

Post a Comment