Skip to content

Checkbox, Radio & Toggle

checkbox

Checkbox with a label. Toggled via on_click.

lua
ui:element({
    id = "opt1", type = "checkbox",
    rect = { unit = "px", x = 10, y = 40, w = 200, h = 24 },
    props = { text = "Enable logging", checked = "true" },
    style = { check_color = "#22C55E" },
    on_click = function(player)
        -- Toggle checked state in your script
    end,
})
PropDescription
textLabel text
checked"true" / "false"
StyleDescription
bgBackground color
check_colorCheckmark / box outline color
textLabel text color
font_sizeLabel font size

radio

Radio button with a label. Use a group of radios with shared on_click logic.

PropDescription
textLabel text
selected"true" / "false"
StyleDescription
bgBackground color
radio_colorDot / circle outline color
textLabel text color
font_sizeLabel font size

toggle

On/off toggle switch with a sliding knob.

lua
ui:element({
    id = "power", type = "toggle",
    rect = { unit = "px", x = 10, y = 40, w = 50, h = 24 },
    props = { value = "true" },
    style = { on_color = "#22C55E", off_color = "#334155", knob = "#FFFFFF" },
    on_click = function(player)
        -- Toggle value in your script
    end,
})
PropDescription
value"true" / "false"
StyleDescription
on_colorBackground when on (default green)
off_colorBackground when off (default dark)
knobKnob color (default white)

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