Below code will help you to resolve this issues, I have created lightning component for Progress Step Indicator and used in flow. I am setting all required inputs in flow using design attributes and based on that dynamic progress step indicator displayed on screen.
ProgressStepIndicator.cmp
<aura:component implements="forceCommunity:availableForAllPageTypes,lightning:availableForFlowScreens"
access="global" ><aura:attribute name="stepNumber" type="String" access="global" default="0"/><aura:attribute name="stepName" type="String" access="global" default="Step"/><aura:attribute name="numberOfSteps" type="Integer" access="global" default=""/><aura:attribute name="screenNumberList" type="List" access="global" default="['1','2','3']"/><aura:handler name="init" value="{!this}" action="{!c.doInit}"/><div class="slds-m-around--large"><lightning:progressIndicator currentStep="{!v.stepNumber}" type="base" variant="base"><aura:iteration items="{!v.screenNumberList}" var="screenNumber"><lightning:progressStep label="{!v.stepName +' '+ screenNumber}"value="{!screenNumber}" /></aura:iteration></lightning:progressIndicator></div></aura:component>
Note: Here I have used <aura:iteration> to iterate progress step based on number of screen
input received from flow. CurrentStep and label for step parameter also set based on input received from flow variable.
input received from flow. CurrentStep and label for step parameter also set based on input received from flow variable.
ProgressStepIndicator.design
<design:component label="Progress Step Indicator"> <design:attribute name="stepNumber" label="Current Step Number" default="0"/>
<design:attribute name="numberOfSteps" label="Number of Steps" default="0"/>
<design:attribute name="stepName" label="Stage Name" default="Step"/> </design:component>Note: Created design attributes to accept Current step number, Number of steps and Step name from Flow screen.
ProgressStepIndicatorController.js
({ doInit : function(component, event, helper) {
var numberOfSteps = component.get('v.numberOfSteps');
var screenNumberList = [];
for(let i=1; i<=numberOfSteps; i++){
screenNumberList.push(i.toString());
}
component.set("v.screenNumberList", screenNumberList);
}
})Lightning component on screen flow and set values:Output:Hope this blog will help you out. Share your thoughts/inputs for any further changes or improvement needed.Thanks,Chandrakant Wani