How to toggle a switch in Svelte #124
-
Hi all, Happy holidays and congrats on this project - seems like an amazing idea to have a robust and well-supported cross-platform, cross-framework set of web components. I backed this project today and started playing around, but am having some trouble and was hoping you can help. I'm trying to use a In the example below, I want the button to toggle the switch, but it doesn't quite seem to work. For example, the default state if Wondering if I'm missing something obvious. I checked all of the places in the docs that seemed they might be relevant, but wasn't able to figure this out. I'm also not sure if this is an issue/question for Svelte since the valueless Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
So this is actually a bug I'll have fixed in the next release 🤦 Our 'dirty checker' isn't flagging changes to If you want a fix today ,you can use the EDIT: playground: https://svelte.dev/playground/6177c10d32574c33b6815a63df93a2b0?version=5.15.0 |
Beta Was this translation helpful? Give feedback.
-
Aha, thank you for the explanation and workaround (and quick response)! |
Beta Was this translation helpful? Give feedback.
-
Actually, I still have a question – it looks like if you set the initial state to I'm not sure I understand what's going on there – do you know if there's a simple way to get the right initial state, as well as updates? |
Beta Was this translation helpful? Give feedback.
-
I tried that before I posted but noticed that if the state is |
Beta Was this translation helpful? Give feedback.
If there’s no easy way to work around in the current version then don't worry about it -- it's no problem for me to wait until the next release. Thanks for the help!