Skip to content

Checkbox

Checkboxes are interactive elements in Basalt that allow users to select or deselect options. They are commonly used in forms and settings menus to indicate whether a particular option is enabled or disabled.

Checkbox inherit from VisualElement and BasicElement

Properties

PropertyTypeDescription
checkedboolIndicates whether the checkbox is currently selected or not.
checkedSymbolcharThe symbol used to represent the checked state.
checkedColorcolorThe color of the symbol when the checkbox is checked.
checkedBgColorcolorThe background color of the symbol when the checkbox is checked.

Example

Click to see example
lua
local main = basalt.getMainFrame()
local aCheckbox = main:addCheckbox()

aCheckbox:onClick(function(self,event,button,x,y)
  if event == "mouse_click" and button == 1 then
    if self.checked then
      basalt.debug("Checkbox is checked!")
    else
      basalt.debug("Checkbox is unchecked!")
    end
  end
end)

Released under the MIT License.