cLib.DPropertySheet

VGUI - Containers Updated: Dec 10, 2025

cLib.DPropertySheet

Tab container with styled tabs.

Basic Usage

local sheet = vgui.Create("cLib.DPropertySheet", parent)
sheet:Dock(FILL)

-- Create tab content panels
local tab1 = vgui.Create("DPanel")
tab1.Paint = function(s, w, h)
    draw.RoundedBox(0, 0, 0, w, h, Color(45, 45, 50))
end

local tab2 = vgui.Create("DPanel")

-- Add tabs
sheet:AddSheet("General", tab1, "icon16/cog.png")
sheet:AddSheet("Advanced", tab2, "icon16/wrench.png")

Methods

MethodDescription
AddSheet(name, panel, icon, noStretch, tooltip)Add tab
SetActiveTab(tab)Set active tab
GetActiveTab()Get active tab
GetItems()Get all tabs
CloseTab(tab, remove)Close/remove tab

Tab Callback

sheet.OnActiveTabChanged = function(self, oldTab, newTab)
    print("Switched from", oldTab:GetText(), "to", newTab:GetText())
end

Settings Panel Example

function CreateSettingsPanel(parent)
    local sheet = vgui.Create("cLib.DPropertySheet", parent)
    sheet:Dock(FILL)
    sheet:DockMargin(cLib.Scale(10), cLib.Scale(10), cLib.Scale(10), cLib.Scale(10))
    
    -- General Tab
    local general = vgui.Create("DPanel")
    general.Paint = nil
    
    local name = vgui.Create("cLib.DTextEntry", general)
    name:SetPlaceholder("Display Name")
    name:Dock(TOP)
    name:DockMargin(0, cLib.Scale(10), 0, 0)
    
    local notif = vgui.Create("cLib.DCheckBoxLabel", general)
    notif:SetText("Enable notifications")
    notif:Dock(TOP)
    notif:DockMargin(0, cLib.Scale(15), 0, 0)
    
    sheet:AddSheet("General", general, "icon16/user.png")
    
    -- Audio Tab
    local audio = vgui.Create("DPanel")
    audio.Paint = nil
    
    local volume = vgui.Create("cLib.DNumSlider", audio)
    volume:SetText("Master Volume")
    volume:SetMin(0)
    volume:SetMax(100)
    volume:Dock(TOP)
    volume:DockMargin(0, cLib.Scale(10), 0, 0)
    
    sheet:AddSheet("Audio", audio, "icon16/sound.png")
    
    -- Video Tab
    local video = vgui.Create("DPanel")
    video.Paint = nil
    
    local quality = vgui.Create("cLib.DComboBox", video)
    quality:SetPlaceholder("Quality")
    quality:AddChoice("Low", 1)
    quality:AddChoice("Medium", 2)
    quality:AddChoice("High", 3)
    quality:Dock(TOP)
    quality:DockMargin(0, cLib.Scale(10), 0, 0)
    
    sheet:AddSheet("Video", video, "icon16/monitor.png")
    
    return sheet
end