Client Utilities

Utilities Updated: Jun 14, 2026

Client Utilities

cLib.Scale

Scale values based on screen resolution (1920x1080 baseline).

local scaledValue = cLib.Scale(value)

Example:

local btn = vgui.Create("DButton", frame)
btn:SetSize(cLib.Scale(200), cLib.Scale(40))
btn:SetPos(cLib.Scale(10), cLib.Scale(10))

cLib.DrawPanelBlur

Draw blur effect on a panel.

cLib.DrawPanelBlur(panel, layers, density)

Example:

function PANEL:Paint(w, h)
    cLib.DrawPanelBlur(self, 4, 6)
    draw.RoundedBox(8, 0, 0, w, h, Color(0, 0, 0, 150))
end

cLib.SmartEllipsis

Truncate text with ellipsis to fit width.

local truncated = cLib.SmartEllipsis(text, maxWidth, font)

Example:

local title = cLib.SmartEllipsis("Very Long Title That Needs Truncating", 200, "DermaDefault")
-- Returns: "Very Long Title Th..."

Notifications

-- Basic notifications: NotifyXxx(title, message, duration?)
cLib.NotifyInfo("Info", "Information message")
cLib.NotifySuccess("Success", "Operation completed!")
cLib.NotifyWarning("Warning", "Be careful!")
cLib.NotifyError("Error", "Something went wrong")

-- Full control: Notify(title, message, type, duration)
cLib.Notify("Custom Title", "Custom message", "info", 10)

Dialogs

-- Confirmation
cLib.Confirm("Delete Item", "Are you sure?",
    function() DeleteItem() end,
    function() print("Cancelled") end
)

-- Alert
cLib.Alert("Notice", "Your session will expire soon")

-- Prompt: Prompt(title, message, placeholder, defaultValue, onSubmit, onCancel)
cLib.Prompt("Rename", "Enter new name:", "Type here...", "Default Value",
    function(text) Rename(text) end,
    function() print("Cancelled") end
)

Context Menu

cLib.ShowContextMenu(options, x, y)

Example:

cLib.ShowContextMenu({
    { text = "Edit", icon = "icon16/pencil.png", callback = function() EditItem() end },
    { text = "Delete", icon = "icon16/cross.png", callback = function() DeleteItem() end },
    { divider = true },
    { text = "More", submenu = {
        { text = "Duplicate", callback = function() DuplicateItem() end },
        { text = "Export", callback = function() ExportItem() end },
    }},
})

Tooltips

-- Assign a tooltip to a panel (shown automatically on hover after `delay` seconds)
cLib.SetTooltip(panel, "This is a tooltip", 0.3)