Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
How to change stepper color with hooks (Material UI)

I don't know how to change the color from primary to success of stepper with React hooks. Unfortunately the stepper does not have a built-in color method such as an icon. And I haven't found any other way to do it. Please help and thank you.

My code:

const steps = ['Select master blaster campaign settings','Create an ad group','Create an ad',];
const [color, setColor] = useState('primary')

const successBoxClicked = (e) => {
setColor('success')}

<Stepper activeStep={1} alternativeLabel>
    {steps.map((label) => (
      <Step key={label}>
        <StepLabel>{label}</StepLabel>
      </Step>
    ))}
  </Stepper>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

so you can go here and see full customization of the MUI components: https://mui.com/customization/how-to-customize/#5-global-css-override

about 4 years ago · Juan Pablo Isaza Report

0

The Stepper is a very complex component! I had to customize one and I used their guide on customization for that component here https://mui.com/components/steppers/#customized-horizontal-stepper

It will depend on what color exactly you want to target. The easiest way to do this might well be by customizing the theme.

However, I'm going to make some guesses. Let's pretend you wanted to change all of the step icons' colors. You could use the StepIconProps prop. I found it here: https://mui.com/api/step-label/

If you're trying to pull a color from the theme like that, you'll need access to the theme directly. Something like this:

const steps = ['Select master blaster campaign settings','Create an ad group','Create an ad',];

const theme = useTheme() // You can import this from material ui
const [color, setColor] = useState(theme.palette.primary.main)

const successBoxClicked = (e) => {
  setColor(theme.palette.success.main)
}

<Stepper activeStep={1} alternativeLabel>
    {steps.map((label) => (
      <Step key={label}>
        <StepLabel StepIconProps={{style: {color}}}>{label}</StepLabel>
      </Step>
    ))}
  </Stepper>

There are certainly other ways to do this. You likely do not need to use style, that was just the easiest way for me to get this out quickly.

Good luck!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!