Select to view content in your preferred language

Issue with controlled Calcite Switch

577
2
Jump to solution
09-25-2023 12:13 PM
FabricioBezerra
New Contributor II
Issue:
I'm setting the Calcite Switch component's "checked" value as a controlled input, but the component's UI state does not reflect the value (images attached)
 
I'm using the following libraries/versions in my React application:

"@arcgis/core"
: "^4.27.6"

"@esri/calcite-components-react": "^1.8.0"

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
omar-marji
New Contributor III

Hello,

Did you try setting undefined instead of false when you want it to be unchecked?

This is mentioned in the gotchas part of the help. It should fix your problem I think.

https://developers.arcgis.com/calcite-design-system/resources/frameworks/#gotchas

View solution in original post

2 Replies
omar-marji
New Contributor III

Hello,

Did you try setting undefined instead of false when you want it to be unchecked?

This is mentioned in the gotchas part of the help. It should fix your problem I think.

https://developers.arcgis.com/calcite-design-system/resources/frameworks/#gotchas

FabricioBezerra
New Contributor II

Thank you so much @omar-marji! That fixed the issue 🎉 

0 Kudos