-
Notifications
You must be signed in to change notification settings - Fork 0
Toggle
A toggle stores a boolean value. Use type = "toggle" or type = "checkbox".

| Field | Type | Description |
|---|---|---|
id |
string | Stable control id. |
key |
string | DB key for direct persistence. |
label |
string | Row label. |
description |
string | Short explanation. |
default |
boolean/function | Default value. |
getValue |
function | Explicit value reader. |
setValue |
function | Explicit value writer. |
isEnabled |
function | Disabled-state gate. |
parentCheck |
function | Parent enabled-state gate. |
Legacy aliases such as var, text, desc, get, and set are only safe
through wrapper/legacy mapping. New direct registrations should use canonical
fields.
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