Skip to content

Display Elements

label

Text display. Supports TMP rich text tags (<b>, <color>, etc.).

lua
ui:element({
    id = "title", type = "label",
    rect = { unit = "px", x = 20, y = 10, w = 200, h = 30 },
    props = { text = "Hello World" },
    style = { font_size = 18, color = "#FFFFFF", align = "left" }
})
PropDescription
textText content (supports TMP rich text)
StyleDescription
font_sizeFont size (default 16)
colorText color
align"left", "center", "right"

panel

Background rectangle. Non-interactive.

lua
ui:element({
    id = "bg", type = "panel",
    rect = { unit = "px", x = 0, y = 0, w = 480, h = 272 },
    style = { bg = "#0F172A" }
})
StyleDescription
bgBackground color
gradientEnd color for gradient (start = bg), array of colors, or array of {position, color} pairs
gradient_dir"horizontal", "vertical" (default), "diagonal", "radial"

progress

Progress bar with filled portion. Supports color stops and indeterminate mode.

lua
-- Basic progress bar
ui:element({
    id = "hp", type = "progress",
    rect = { unit = "px", x = 10, y = 10, w = 200, h = 20 },
    props = { value = 75, min = 0, max = 100 },
    style = { bg = "#1E293B", fill = "#22C55E" },
})

-- With color stops (fill changes color based on value)
ui:element({
    id = "temp", type = "progress",
    rect = { unit = "px", x = 10, y = 40, w = 200, h = 20 },
    props = { value = 0.7 },
    style = {
        bg = "#1E293B",
        fill = "#22C55E",
        color_stops = {
            { 0.5, "#EAB308" },    -- yellow from 50%
            { 0.8, "#EF4444" },    -- red from 80%
        },
    },
})

-- Indeterminate (animated sliding bar)
ui:element({
    id = "loading", type = "progress",
    rect = { unit = "px", x = 10, y = 70, w = 200, h = 8 },
    props = { indeterminate = true },
    style = { bg = "#1E293B", fill = "#38BDF8" },
})
PropDescription
valueCurrent value (ignored in indeterminate mode)
minMinimum value (default 0)
maxMaximum value (default 1)
indeterminateIf true, shows animated sliding fill
StyleDescription
bgTrack background color
fillBase fill color
color_stopsArray of { fraction, "#color" } — fill color changes at thresholds
speedAnimation speed for indeterminate mode (default 1.2)

divider

Horizontal or vertical separator line.

lua
ui:element({
    id = "sep", type = "divider",
    rect = { unit = "px", x = 10, y = 50, w = 460, h = 1 },
    style = { color = "#334155" }
})
StyleDescription
colorDivider color (default gray)

⚠️ This documentation was AI-generated and may contain inaccuracies. Please submit pull requests with corrections as needed.