Toggles
Toggles are used to toggle features in Obsidian
Playground
Enable Speed Hack
Usage
You can create a Toggle by calling the AddToggle
method on a Groupbox.
You can override the default :AddToggle
method to make a checkbox element instead by doing:
Arguments
Arg Idx | Argument Description | Type | Default |
---|---|---|---|
1 | Index/ID of the toggle | string | nil |
2 | Toggle configuration table | table | nil |
Configuration Table
Prop
Type
Methods
You can use the following methods to interact with the toggle:
SetValue
Sets the toggle value.
Arg Idx | Argument Description | Type | Default |
---|---|---|---|
1 | The new value of the toggle | boolean | nil |
SetText
Updates the toggle's text.
Arg Idx | Argument Description | Type | Default |
---|---|---|---|
1 | The new text of the toggle | string | nil |
SetDisabled
Enables or disables the toggle.
Arg Idx | Argument Description | Type | Default |
---|---|---|---|
1 | Whether to disable the toggle | boolean | nil |
SetVisible
Shows or hides the toggle.
Arg Idx | Argument Description | Type | Default |
---|---|---|---|
1 | Whether to show the toggle | boolean | nil |
OnChanged
Adds another callback function to the toggle. This is the recommended way to listen for changes in the toggle.
Arg Idx | Argument Description | Type | Default |
---|---|---|---|
1 | The callback function | function | nil |