To create a fully custom visual design for your flow's progress indicator, or to maintain an existing custom stages component, you can build a screen component that renders stages by wiring it to the $Flow.ActiveStages and $Flow.CurrentStage global variables in Flow Builder.
To show stages in a standard path or steps style, use the built-in progress indicator instead. No custom component required. See Showing Users Their Progress in a Screen Flow.
How Flow Stages Work
You can define stages as resources with Flow Builder. Each stage has a label, an API name, and an order. Stages can be active by default, meaning they appear in $Flow.ActiveStages when a flow interview starts. You control which stage is current by updating $Flow.CurrentStage with assignment elements between screens.
Your screen component receives two values:
stages— the list of active stage labels, sourced from$Flow.ActiveStagesas aString[]currentStage— the label of the current stage, sourced from$Flow.CurrentStageas aString
Create the Screen Component
The component declares stages and currentStage as @api properties and registers them in the component's configuration file so Flow Builder can wire them to flow variables.
JavaScript
// flowStages.js
import { LightningElement, api } from "lwc";
export default class FlowStages extends LightningElement {
@api stages = [];
@api currentStage;
}
HTML Template
<!-- prettier-ignore --><!-- flowStages.html -->
<template>
<lightning-progress-indicator current-step={currentStage} type="path">
<template for:each={stages} for:item="stage">
<lightning-progress-step key={stage} label={stage} value={stage}>
</lightning-progress-step>
</template>
</lightning-progress-indicator>
</template>
Configuration File
<!-- flowStages.js-meta.xml -->
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>68.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__FlowScreen</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__FlowScreen">
<property name="stages" type="String[]" />
<property name="currentStage" type="String" />
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
Add the Component to Your Flow Screens in Flow Builder
- Open your screen flow in Flow Builder.
- Define your stages as flow resources. In the Manager panel, click New Resource, select Stage, and enter a label and order for each stage. To include a stage in
$Flow.ActiveStagesat the start of the flow interview, select Active by default. - On each screen element that should show the progress indicator, add the custom stages component.
- For the Stages property, enter
{!$Flow.ActiveStages}. For the Current Stage property, enter{!$Flow.CurrentStage}. In the Advanced section, select Manually Assign Variables. - Between each pair of screen elements, add an assignment element that sets
$Flow.CurrentStageto the label of the next stage.
See Also