How to create a page control button with function of checkbox widget

<$checkbox tiddler="$:/plugins/rmnvsl/krystal/config/close" field="text" checked="enable" unchecked="disable" default="enable"></$checkbox>

This is a setting in the Krystal plug in using checkbox widget to enable and disable a functionality.
I want to create a page control button to mimic the action of this checkbox widget. How to do it?

Try this:

Create a tiddler (e.g., “ToggleKrystalClose”), tagged with $:/tags/PageControls, containing:

<$button class="tc-btn-invisible">
   <$let tid="$:/plugins/rmnvsl/krystal/config/close" state={{{ [<tid>get[text]] }}}>
   <$list filter="[<state>match[enable]] ~[<state>match[]]">
      on <$action-setfield $tiddler=<<tid>> text="disable"/>
   </$list>
   <$list filter="[<state>match[disable]]">
      off <$action-setfield $tiddler=<<tid>> text="enable"/>
   </$list>
   </$let>
</$button>

Notes:

  • Replace “on” and “off” labels with whatever icons(?) you want to use to show the state of the setting
1 Like

Thank you @EricShulman. That works perfectly.