I have been trying to modify the standard color for the 'completed' steps on the lightning-progress-indicator LWC (path type): https://developer.salesforce.com/docs/component-library/bundle/lightning-progress-indicator/example
I have a custom LWC that contains a lightning-progress-indicator with dinamically generated lightning-progress-step.
Custom LWC HTML:
<template>
<lightning-progress-indicator current-step={currentStep} type="path" variant="base">
<template for:each={steps} for:item="step">
<lightning-progress-step label={step.label} value={step.value} key={step.label} ></lightning-progress-step>
</template>
</lightning-progress-indicator>
Custom LWC JS:
import { api, LightningElement } from 'lwc';
import getStepsForPath from '@salesforce/apex/Controller.getStepsForPath';
export default class ProgressIndicatorPathTypeWithIteration extends LightningElement {
steps;
currentStep;
connectedCallback() {
getStepsForPath({})
.then(result => {
if (result) {
let stepsResult = JSON.parse(result);
for(let step of stepsResult) {
if(step.isCurrent) {
this.currentStep = step.value;
break;
}
}
this.steps = stepsResult;
}
})
.catch(error => { });
}
}
Custom LWC CSS:
:host {
--slds-c-path-color-background: var(--lwc-colorBackgroundAltInverse) !important;
--slds-c-path-link-color-background: var(--lwc-colorBackgroundAltInverse) !important;
--slds-c-path-nav-color-background: var(--lwc-colorBackgroundAltInverse) !important;
--slds-c-path-item-color-background: var(--lwc-colorBackgroundAltInverse) !important;
--slds-c-path-color-background-hover: var(--lwc-colorBackgroundAltInverse) !important;
--slds-c-path-link-color-background-hover: var(--lwc-colorBackgroundAltInverse) !important;
--slds-c-path-nav-color-background-hover: var(--lwc-colorBackgroundAltInverse) !important;
--slds-c-path-item-color-background-hover: var(--lwc-colorBackgroundAltInverse) !important;
}
All of the css in :host or any custom class is completely ignored. How can I change the background color of the steps inside the progress indicator component?
Best Answer
For
type="base"
use theprogressBarColorBackgroundFill
design token to change the default color of the Progress indicator.CSS
HTML
For
type="path"
use thecolorBackgroundPathComplete
andcolorBackgroundPathCompleteHover
design token to change the default color of the progress indicator.CSS
HTML