Skip to content
SomeeNamePublic

About

Retained-mode GUI framework for LÖVE 12 (windows, tabs, scrollable groups, checkboxes, sliders, dropdowns, color picker, keybinds)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

KilnUI

A retained-mode GUI framework for LÖVE 12, written in Lua. Windows, tabs, scrollable group boxes and the usual set of controls, with a modern dark theme.

KilnUI demo

Features

  • Windows that can be dragged by their title bar, with z-ordering by last interaction
  • Tabs and group boxes with automatic vertical layout, a scrollbar when the content overflows, and clipping
  • Controls: checkbox, slider, combobox, multiselect, HSV color picker with alpha, keybind
  • Popup layer: dropdowns and the color picker are drawn above all windows and block input to everything underneath while open
  • Covered windows do not receive clicks meant for the window above them
  • Callbacks that fire when a widget value changes, for example to show or hide other widgets
  • Theme in one file (kilnui/theme.lua): colors, radii, spacing and font sizes

Popups

Requirements

LÖVE 12.0. Development builds are available from the LÖVE GitHub Actions.

Quick start

Copy the kilnui folder into your project and call KilnUI.draw() from love.draw.

local KilnUI = require("kilnui")

-- Forward mouse wheel events to KilnUI
function love.wheelmoved(x, y)
    KilnUI.wheel_moved(x, y)
end

local window = KilnUI.window("Settings", 40, 40, 400, 360)
local tabs = KilnUI.tabpanel(window, "Tabs", {"General", "About"})
KilnUI.set(tabs, 1)

local group = KilnUI.groupbox(window, "General", "Editor", 0, 0, 340, 260)
local fontSize = KilnUI.slider(group, "Font size", 10, 24, 14, false, " px", 1)
local autosave = KilnUI.checkbox(group, "Autosave")
local delay = KilnUI.slider(group, "Autosave delay", 1, 60, 5, false, " s", 1)
local theme = KilnUI.combobox(group, "Color theme", {"Dark", "Light", "High contrast"})
local accent = KilnUI.colorpicker(group, "Accent color", 108, 121, 242, 255)

-- Only show the delay while autosave is enabled
KilnUI.ui_callback(autosave, function()
    delay:setVisible(KilnUI.get(autosave))
end)

function love.draw()
    KilnUI.draw()
end

API

Function Description
KilnUI.window(title, x, y, w, h) Creates a window
KilnUI.tabpanel(window, title, tabs) Adds a tab bar to a window. tabs is a list of names
KilnUI.groupbox(window, tab, title, x, y, w, h) Adds a group box to a tab, or directly to the window when tab is nil
KilnUI.checkbox(groupbox, title) Checkbox, value is true or false
KilnUI.slider(groupbox, title, min, max, value, show_tooltip, unit, scale) Slider with a unit suffix such as " px"
KilnUI.combobox(groupbox, title, items) Single selection from a list
KilnUI.multiselect(groupbox, title, items) Multiple selection, value is a list of items
KilnUI.colorpicker(widget, title, r, g, b, a) Color picker, value is {r, g, b, a} in the range 0 to 255. Can be attached to a group box or next to a checkbox
KilnUI.keybind(widget, title) Click to listen, the next key becomes the binding. Escape clears it
KilnUI.get(widget) / KilnUI.set(widget, value) Read or set a widget value
KilnUI.ui_callback(widget, func) Calls func whenever the widget value changes
KilnUI.register_callback(func) Calls func every frame before drawing
KilnUI.wheel_moved(dx, dy) Forward love.wheelmoved here. The group box under the cursor scrolls. KilnUI never overrides LÖVE callbacks itself
widget:setVisible(visible) Hides a widget, hidden widgets take no space in the layout
KilnUI.draw() Updates and draws everything. Call it from love.draw

Running the demo

love .

The demo in main.lua is the settings window of a small fictional code editor plus a second window to show z-ordering.

On Windows, build.ps1 creates dist/KilnUI.love, and build.ps1 -Exe a standalone dist/KilnUI/KilnUI.exe. Open KilnUI.code-workspace in VS Code to get debugging (F5) and LÖVE autocompletion.

Project structure

kilnui/
  init.lua         entry point and public API
  popup.lua        popup layer (one active popup, drawn above all windows)
  input.lua        mouse and keyboard state per frame
  renderer.lua     drawing helpers on top of love.graphics
  theme.lua        colors, sizes, fonts
  widget.lua       base class (position, parent and children, visibility)
  container.lua    window
  tab.lua, group_box.lua, checkbox.lua, slider.lua,
  combobox.lua, multiselect.lua, colorpicker.lua, keybind.lua
  fonts/           Inter (SIL Open Font License)
docs/              screenshots
main.lua           demo

Known limitations

  • No text input widget
  • Mouse wheel scrolling is vertical only
  • Keybinds are single keys, no combinations like Ctrl+P
  • Popups do not flip upwards at the screen edge
  • Clipping uses screen coordinates, so love.graphics transforms such as scaling are not supported

History

The architecture and widget logic (retained-mode widget tree, z-ordering, layout and scroll logic, dropdowns) were written in 2021 as an overlay UI for a Lua scripting environment. In 2026 the framework was ported to LÖVE 12. The port, the rendering backend, the new visual design and the following refactors were co-authored with Claude (Anthropic) as an AI pair programmer.

License

MIT, see LICENSE. The bundled Inter font is licensed under the SIL Open Font License 1.1, see kilnui/fonts/OFL.txt.

About

Retained-mode GUI framework for LÖVE 12 (windows, tabs, scrollable groups, checkboxes, sliders, dropdowns, color picker, keybinds)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages