Skip to content
R41z0r edited this page Jun 13, 2026 · 2 revisions

Contents

A toggle stores a boolean value. Use type = "toggle" or type = "checkbox".

Field Type Description
id string Stable control id.
key / var string DB key for default persistence.
label / text string Row label.
description / desc string Short explanation.
default boolean/function Default value.
getValue / get function Explicit value reader.
setValue / set function Explicit value writer.
isEnabled function Disabled-state gate.
parentCheck function Parent enabled-state gate.
app:RegisterControl("general.core", {
  id = "enabled",
  key = "enabled",
  type = "toggle",
  label = ENABLE or "Enable",
  description = "Enable this feature.",
  default = true,
})
app:RegisterControl("general.core", {
  id = "privateMode",
  type = "toggle",
  label = "Private mode",
  default = false,
  getValue = function()
    return MyAddonPrivateDB.privateMode == true
  end,
  setValue = function(value)
    MyAddonPrivateDB.privateMode = value == true
    MyAddon.RefreshPrivateMode()
  end,
})
  • Do not store string values like "true" or "false".
  • Do not rebuild the settings frame from the setter.
  • Use explicit getters/setters for nested DB values.

Wiki
  • Home
  • Architecture
  • Vendoring
  • Quick Start
  • Field Glossary
  • Troubleshooting
  • Validation

Reference
  ⚬ Config API
  ⚬ UI API
  ⚬ Elements
  ⚬ Examples

Elements
  Structure
   • Category
   • Page
   • Group
   • Dashboard
   • InfoPage
   • Custom
  Controls
   • Toggle
   • CheckboxDropdown
   • Dropdown
   • MultiDropdown
   • SoundDropdown
   • Input
   • Slider
   • Button
  Advanced
   • ColorPicker
   • ColorPalette
   • ColorOverrides
   • ReorderList
   • Expandable
   • Notes

Examples
  Start
   • Minimal Addon
   • Complete Settings Center
   • Wrapper Bridge Pattern
  Data and Behavior
   • Dependent Controls
   • Nested Database Values
   • Dynamic Dropdowns
   • Runtime Refresh
   • Search and New Badges
   • Custom Hosted Editors
  Polish
   • Support Links
   • Theme Colors
   • Theme Borders

Clone this wiki locally