Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.1K
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda