I created a very simple switch toggle field for the panel. It’s basically a simple single checkbox with an checked or not state (therefore this documentation applies). But with a lil CSS to make it look more fancy - or smooth. I just like it better for some things than a single checkbox or the existing radiobutton toggle option.
I just released an update of the Switch field and bumped up the version number to 1.0.0. As the version number suggests, this update changes a few things that can break current setups. You can find it at https://github.com/distantnative/field-switch
Main change is that I restructured the field to be delivered as it plugin (which requires Kirby 2.3 - currently in beta). It goes into site/plugins/field-switch/. The plugin then registers the field. With the new registry in Kirby 2.3, I believe all third-party elements like fields, snippets, blueprints etc. should also be delivered wrapped as a plugin. This enables us to keep only custom elements that are rather specific to the project in site/fields, site/tags etc.
Changlog
Restructured as Kirby plugin that registers the field (requires Kirby 2.3)
More precise plugin name field-switch (required renaming repository)
I just tried both of your examples above and can only get the second version using bool() to behave correctly. Thought I’d mention in case this is useful for anyone else!
Thanks for pointing this out. There was a typo in Sonja’s post which I have now corrected. However the bool() method is preferred anyway as it is more robust.