Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda