LogoObsidian
Dependency

Dependency Boxes

Conditionally display a list of toggles and options based on the dependencies set.

Dependency boxes are non visible containers that live inside the groupbox that created them used to hide and show elements contained within it based on the dependencies set.

Audio Settings
Enable Audio

Usage

You can create a Dependency Box by calling the AddDependencyBox method on a Groupbox.

local Toggles = Library.Toggles
local LeftGroupbox = MainTab:AddLeftGroupbox("Settings", "wrench")
 
LeftGroupbox:AddToggle("EnableAudio", {
    Text = "Enable Audio",
    Default = false
})
 
local AudioSettings = LeftGroupbox:AddDependencyBox()
 
AudioSettings:AddSlider("Volume", {
    Text = "Volume",
    Default = 50,
    Min = 0,
    Max = 100,
    Rounding = 0
})
 
AudioSettings:SetupDependencies({
    { Toggles.EnableAudio, true }, -- Only show if EnableAudio is true
    -- { Options.AudioMode, "Stereo" } -- And also only show if AudioMode is Stereo
})

Methods

SetupDependencies

Setup the dependencies for the dependency box.

DependencyBox:SetupDependencies(dependencies)
Arg IdxArgument DescriptionTypeDefault
1table of dependenciestablenil

On this page