ImGuiWindow:Checkbox Asynchronous

Add a checkbox with an initial checked state and a change callback. Use it for an on/off setting. Keep the new callback value in your own settings table if other code needs it.

Syntax
Luau
ImGuiWindow:Checkbox(
    label: string,
    checked: any?,
    callback: (boolean) -> ()
) -> ImGuiWindow

Parameters

Call this method with a ImGuiWindow receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

Function parameters
ParameterTypeDescription
labelstringText displayed next to the checkbox.
checkedany?Initial state using Luau truthiness: only false and nil are unchecked.
callback(boolean) -> ()Receives the new checked state as a boolean.

Returns

ImGuiWindow

The same ImGuiWindow, allowing another window method to be chained.

Usage notes

Interaction callbacks run when the control is used. Their return values are discarded.

Example

Example
Luau
local window = imgui.create("Example controls")
local settings = { showLabels = true }
window:Checkbox("Show labels", settings.showLabels, function(checked)
    settings.showLabels = checked
    print("Labels enabled:", checked)
end)
Kawaii documentation