Skip to content

Dependent Controls

R41z0r edited this page Jun 13, 2026 · 1 revision

Contents

The row remains visible but disabled.

local function featureEnabled()
  return MyAddonDB.profile.enabled == true
end

app:RegisterControl("general.core", {
  id = "scale",
  key = "scale",
  type = "slider",
  label = "Scale",
  min = 0.5,
  max = 2,
  step = 0.05,
  default = 1,
  parentCheck = featureEnabled,
})

The row is removed from the rendered page.

visibleWhen = function()
  return MyAddonDB.profile.advanced == true
end
local parent = addon.functions.SettingsCreateCheckbox(category, {
  var = "featureEnabled",
  text = L["featureEnabled"],
  default = false,
  parentSection = section,
})

addon.functions.SettingsCreateSlider(category, {
  var = "featureScale",
  text = L["featureScale"],
  min = 0.5,
  max = 2,
  step = 0.05,
  default = 1,
  parentSection = section,
  element = parent and parent.element,
  parentCheck = function()
    return addon.db.featureEnabled == true
  end,
})

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