FlexLöve

A comprehensive UI library for LÖVE Framework based on flexbox

🎨 Flexbox & Grid Layouts

Modern CSS-like layout system with full flexbox and grid support for building responsive UIs.

🎭 Theme System

9-patch NinePatch theming with state support (normal, hover, pressed, disabled).

✨ Animations

Built-in animation support for smooth transitions and effects with easing functions.

📱 Responsive Design

Viewport units (vw, vh, %) for automatic resizing and responsive layouts.

⚡ Immediate Mode

Optional immediate mode support alongside traditional retained mode rendering.

🎯 Event System

Rich event handling with callbacks, focus management, and input fields.

Quick Start

local FlexLove = require("FlexLove")

-- Initialize with base scaling and theme
FlexLove.init({
  baseScale = { width = 1920, height = 1080 },
  theme = "space"
})

-- Create a button
local button = FlexLove.new({
  width = "20vw",
  height = "10vh",
  backgroundColor = Color.new(0.2, 0.2, 0.8, 1),
  text = "Click Me",
  themeComponent = "button",
  onEvent = function(element, event)
    print("Button clicked!")
  end
})

-- In your love callbacks
function love.update(dt)
  FlexLove.update(dt)
end

function love.draw()
  FlexLove.draw()
end

Documentation

The API reference is available in two formats:

These docs are auto-generated from LuaLS annotations using the Lua Language Server.

Installation

Add the modules directory and FlexLove.lua into your LÖVE project.

git clone https://github.com/mikefreno/FlexLove.git
cp -r FlexLove/modules your-project/
cp FlexLove/FlexLove.lua your-project/