Skip to content

Slider, Select & TextInput

slider

Horizontal slider with draggable handle.

lua
ui:element({
    id = "vol", type = "slider",
    rect = { unit = "px", x = 10, y = 40, w = 200, h = 20 },
    props = { value = "0.5", min = "0", max = "1" },
    style = { bg = "#1E293B", fill = "#3B82F6", handle = "#FFFFFF" },
    on_change = function(value, player)
        print("New value:", value)
    end,
})
PropDescription
valueCurrent value
minMinimum (default 0)
maxMaximum (default 100)
StyleDescription
bgTrack background
fillFilled portion color
handleHandle color
EventCallback Args
on_change(value, playerName)

select

Dropdown select. Options are pipe-delimited.

lua
ui:element({
    id = "mode", type = "select",
    rect = { unit = "px", x = 10, y = 40, w = 200, h = 28 },
    props = { options = "Auto|Manual|Off", selected = "0", open = "false" },
    style = { bg = "#1E293B", text = "#E2E8F0", font_size = 12 },
    on_toggle = function(player)
        -- Toggle props.open between "true"/"false"
    end,
    on_change = function(value, player)
        print("Selected index:", value)
    end,
})
PropDescription
optionsPipe-delimited option strings
selected0-based selected index
open"true" / "false" — dropdown visibility
EventCallback Args
on_toggle(playerName) — dropdown opened/closed
on_change(optionIndex, playerName) — option selected

textinput

Single-line text input. In interface mode: direct keyboard input. Outside: modal text dialog.

lua
ui:element({
    id = "name_input", type = "textinput",
    rect = { unit = "px", x = 10, y = 40, w = 200, h = 28 },
    props = { value = "", placeholder = "Enter name...", title = "Name" },
    style = { bg = "#0F172A", text = "#E2E8F0", placeholder_color = "#475569", font_size = 12 },
    on_change = function(value, player)
        print("Input:", value)
    end,
})
PropDescription
valueCurrent text value
placeholderPlaceholder text when empty
titleDialog title (non-interface mode)
EventCallback Args
on_change(value, playerName) — fired on end-edit

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