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

216
Views
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 answers
Answer question

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 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!