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

223
Visualizações
Material UI Switch: Visually show the switch as enabled when the value of "checked" is false

I'm using Material UI Switches with Formik. Whenever I "enable" the switch it automatically marks the value in Formik as "true" and when I "disable" the switch it marks the value in Formik as "false".

I'm looking to invert the UI switch so when my Formik value is "true" the switch displays a "false" value. I've tried modifying the "checked" value on the switch to no avail, and I've started playing with the styling properties of the switch as well.

Any ideas would be appriciated, thanks!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

What I understand is that you want to invert the behaviour of the switch component, so when the Formik value is true the switch should display false and vice versa.

If that's the case, why not just take the negative of the Formik value?

 <Switch {...label} checked={!formikValue} onChange={handleChange} />

Here's a sandbox

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