Animation

apply

(method) Animation:apply(element: Element)

duration

number

elapsed

number

fade

function Animation.fade(duration: number, fromOpacity: number, toOpacity: number)
  -> Animation

Create a simple fade animation

final

{ width: number, height: number, opacity: number }

interpolate

(method) Animation:interpolate()
  -> table

new

function Animation.new(props: AnimationProps)
  -> Animation

scale

function Animation.scale(duration: number, fromScale: table, toScale: table)
  -> Animation

Create a simple scale animation

@param fromScale — {width:number,height:number}

@param toScale — {width:number,height:number}

start

{ width: number, height: number, opacity: number }

transform

table?

transition

table?

update

(method) Animation:update(dt: number)
  -> boolean


⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


__index

Animation

_resultDirty

boolean

AnimationProps

duration

number

final

{ width: number, height: number, opacity: number }

start

{ width: number, height: number, opacity: number }

transform

table?

transition

table?

Color

a

number

Alpha component (0-1)

b

number

Blue component (0-1)

fromHex

function Color.fromHex(hexWithTag: string)
  -> Color

Convert hex string to color Supports both 6-digit (#RRGGBB) and 8-digit (#RRGGBBAA) hex formats

@param hexWithTag — e.g. “#RRGGBB” or “#RRGGBBAA”

g

number

Green component (0-1)

isValidColorFormat

function Color.isValidColorFormat(value: any)
  -> format: string?

Check if a value is a valid color format

@param value — Value to check

@return format — Format type (hex, rgb, rgba, named, table, nil if invalid)

new

function Color.new(r?: number, g?: number, b?: number, a?: number)
  -> Color

Create a new color instance

parse

function Color.parse(value: any)
  -> Color

Parse a color from various formats

@param value — Color value (hex, named, table)

@return — Parsed color

r

number

Red component (0-1)

sanitizeColor

function Color.sanitizeColor(value: any, default?: Color)
  -> Color

Sanitize a color value

@param value — Color value to sanitize

@param default — Default color if invalid

@return — Sanitized color

toRGBA

(method) Color:toRGBA()
  -> r: number
  2. g: number
  3. b: number
  4. a: number

validateColor

function Color.validateColor(value: any, options?: table)
  -> valid: boolean
  2. error: string?

Validate a color value

@param value — Color value to validate

@param options — Validation options

@return valid — True if valid

@return error — Error message if invalid

validateColorChannel

function Color.validateColorChannel(value: any, max?: number)
  -> valid: boolean
  2. clamped: number?

Validate a single color channel value

@param value — Value to validate

@param max — Maximum value (255 for 0-255 range, 1 for 0-1 range)

@return valid — True if valid

@return clamped — Clamped value in 0-1 range

validateHexColor

function Color.validateHexColor(hex: string)
  -> valid: boolean
  2. error: string?

Validate hex color format

@param hex — Hex color string (with or without #)

@return valid — True if valid format

@return error — Error message if invalid

validateNamedColor

function Color.validateNamedColor(name: string)
  -> valid: boolean
  2. error: string?

Validate named color

@param name — Color name

@return valid — True if valid

@return error — Error message if invalid

validateRGBColor

function Color.validateRGBColor(r: number, g: number, b: number, a?: number, max?: number)
  -> valid: boolean
  2. error: string?

Validate RGB/RGBA color values

@param r — Red component

@param g — Green component

@param b — Blue component

@param a — Alpha component (optional)

@param max — Maximum value (255 or 1)

@return valid — True if valid

@return error — Error message if invalid



⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


__index

Color

Utility class for color handling

Element

active

boolean?

Whether the element is active/focused (for inputs, default: false)

addChild

(method) Element:addChild(child: Element)

Add child to element

alignContent

AlignContent

Alignment of lines in multi-line flex containers (default: STRETCH)

alignItems

AlignItems

Alignment of items along cross axis (default: STRETCH)

alignSelf

AlignSelf

Alignment of the item itself along cross axis (default: AUTO)

animation

table?

Animation instance for this element

applyPositioningOffsets

(method) Element:applyPositioningOffsets(element: any)

Apply positioning offsets (top, right, bottom, left) to an element @param element The element to apply offsets to

autoGrow

boolean

Whether element auto-grows with text (default: false)

autoScaleText

boolean

Whether text should auto-scale with window size (default: true)

autosizing

{ width: boolean, height: boolean }

Whether the element should automatically size to fit its children

backdropBlur

{ intensity: number, quality: number }?

Blur content behind the element (intensity: 0-100, quality: 1-10)

backgroundColor

Color

Background color of the element

blur

(method) Element:blur()

Remove focus from this element

border

Border

Border configuration for the element

borderColor

Color

Color of the border

bottom

number?

Offset from bottom edge (CSS-style positioning)

calculateAutoHeight

(method) Element:calculateAutoHeight()
  -> number

Calculate auto height based on children

calculateAutoWidth

(method) Element:calculateAutoWidth()
  -> number

calculateTextHeight

(method) Element:calculateTextHeight()
  -> number

calculateTextWidth

(method) Element:calculateTextWidth()
  -> number

Calculate text width for button

children

table<integer, Element>

Children of this element

clearChildren

(method) Element:clearChildren()

Remove all children from this element

clearSelection

(method) Element:clearSelection()

Clear selection

columnGap

(string|number)?

Gap between grid columns

contains

(method) Element:contains(x: number, y: number)
  -> boolean

Check if point is inside element bounds

contentAutoSizingMultiplier

{ width: number?, height: number? }?

Multiplier for auto-sized content dimensions

contentBlur

{ intensity: number, quality: number }?

Blur the element’s content including children (intensity: 0-100, quality: 1-10)

cornerRadius

(number|{ topLeft: number?, topRight: number?, bottomLeft: number?, bottomRight: number? })?

Corner radius for rounded corners (default: 0)

cursorBlinkRate

number

Cursor blink rate in seconds (default: 0.5)

cursorColor

Color?

Cursor color (default: nil, uses textColor)

deleteSelection

(method) Element:deleteSelection()
  -> boolean

Delete selected text

@return — True if text was deleted

deleteText

(method) Element:deleteText(startPos: number, endPos: number)

@param startPos — Start position (inclusive)

@param endPos — End position (inclusive)

destroy

(method) Element:destroy()

Destroy element and its children

disableHighlight

boolean?

Whether to disable the pressed state highlight overlay (default: false)

disabled

boolean?

Whether the element is disabled (default: false)

draw

(method) Element:draw(backdropCanvas: any)

Draw element and its children

editable

boolean

Whether the element is editable (default: false)

flexDirection

FlexDirection

Direction of flex layout (default: HORIZONTAL)

flexWrap

FlexWrap

Whether children wrap to multiple lines (default: NOWRAP)

focus

(method) Element:focus()

Focus this element for keyboard input

fontFamily

string?

Font family name from theme or path to font file

gap

string|number

Space between children elements (default: 10)

getAvailableContentHeight

(method) Element:getAvailableContentHeight()
  -> number

Get available content height for children (accounting for 9-patch content padding) This is the height that children should use when calculating percentage heights

getAvailableContentWidth

(method) Element:getAvailableContentWidth()
  -> number

Get available content width for children (accounting for 9-patch content padding) This is the width that children should use when calculating percentage widths

getBlurInstance

(method) Element:getBlurInstance()
  -> table?

Get or create blur instance for this element

@return — Blur instance or nil if no blur configured

getBorderBoxHeight

(method) Element:getBorderBoxHeight()
  -> number

Get border-box height (including padding)

getBorderBoxWidth

(method) Element:getBorderBoxWidth()
  -> number

Get border-box width (including padding)

getBounds

(method) Element:getBounds()
  -> { x: number, y: number, width: number, height: number }

Get element bounds (content box)

getChildCount

(method) Element:getChildCount()
  -> number

Get the number of children this element has

getContentSize

(method) Element:getContentSize()
  -> contentWidth: number
  2. contentHeight: number

Get content dimensions (including overflow) (delegates to ScrollManager)

getCursorPosition

(method) Element:getCursorPosition()
  -> number

Get cursor position

@return — Character index (0-based)

getMaxScroll

(method) Element:getMaxScroll()
  -> maxScrollX: number
  2. maxScrollY: number

Get maximum scroll bounds (delegates to ScrollManager)

getScaledContentPadding

(method) Element:getScaledContentPadding()
  -> table|nil

Get the current state’s scaled content padding Returns the contentPadding for the current theme state, scaled to the element’s size

@return — {left, top, right, bottom} or nil if no contentPadding

getScrollPercentage

(method) Element:getScrollPercentage()
  -> percentX: number
  2. percentY: number

Get scroll percentage (0-1) (delegates to ScrollManager)

getScrollPosition

(method) Element:getScrollPosition()
  -> scrollX: number
  2. scrollY: number

Get current scroll position (delegates to ScrollManager)

getSelectedText

(method) Element:getSelectedText()
  -> string?

Get selected text

@return — Selected text or nil if no selection

getSelection

(method) Element:getSelection()
  -> number?
  2. number?

Get selection range

@return — Start and end positions, or nil if no selection

getText

(method) Element:getText()
  -> string

Get current text buffer

gridColumns

number?

Number of columns in the grid

gridRows

number?

Number of rows in the grid

hasOverflow

(method) Element:hasOverflow()
  -> hasOverflowX: boolean
  2. hasOverflowY: boolean

Check if element has overflow (delegates to ScrollManager)

hasSelection

(method) Element:hasSelection()
  -> boolean

Check if there is an active selection

height

string|number

Height of the element

hide

(method) Element:hide()

same as calling updateOpacity(0)

hideScrollbars

(boolean|{ vertical: boolean, horizontal: boolean })?

Hide scrollbars (boolean for both, or table for individual control)

id

string

image

(love.Image)?

Image object to display

imageOpacity

number?

Image opacity 0-1 (default: 1, combines with element opacity)

imagePath

string?

Path to image file (auto-loads via ImageCache)

inputType

"email"|"number"|"text"|"url"

Input type for validation (default: “text”)

insertText

(method) Element:insertText(text: string, position?: number)

Insert text at position

@param text — Text to insert

@param position — Position to insert at (default: cursor position)

isFocused

(method) Element:isFocused()
  -> boolean

Check if this element is focused

justifyContent

JustifyContent

Alignment of items along main axis (default: FLEX_START)

justifySelf

JustifySelf

Alignment of the item itself along main axis (default: AUTO)

keypressed

(method) Element:keypressed(key: string, scancode: string, isrepeat: boolean)

Handle key press (special keys)

@param key — Key name

@param scancode — Scancode

@param isrepeat — Whether this is a key repeat

layoutChildren

(method) Element:layoutChildren()

left

number?

Offset from left edge (CSS-style positioning)

margin

{ top: number, right: number, bottom: number, left: number }

Margin around children (default: {top=0, right=0, bottom=0, left=0})

maxLength

number?

Maximum text length in characters (default: nil)

maxLines

number?

Maximum number of lines (default: nil)

maxTextSize

number?

minTextSize

number?

moveCursorBy

(method) Element:moveCursorBy(delta: number)

Move cursor by delta characters

@param delta — Number of characters to move (positive or negative)

moveCursorToEnd

(method) Element:moveCursorToEnd()

Move cursor to end of text

moveCursorToLineEnd

(method) Element:moveCursorToLineEnd()

Move cursor to end of current line

moveCursorToLineStart

(method) Element:moveCursorToLineStart()

Move cursor to start of current line

moveCursorToNextWord

(method) Element:moveCursorToNextWord()

Move cursor to start of next word

moveCursorToPreviousWord

(method) Element:moveCursorToPreviousWord()

Move cursor to start of previous word

moveCursorToStart

(method) Element:moveCursorToStart()

Move cursor to start of text

multiline

boolean

Whether the element supports multiple lines (default: false)

new

function Element.new(props: ElementProps, deps: table)
  -> Element

@param deps — Required dependency table (provided by FlexLove)

objectFit

("contain"|"cover"|"fill"|"none"|"scale-down")?

Image fit mode (default: “fill”)

objectPosition

string?

Image position like “center center”, “top left”, “50% 50%” (default: “center center”)

onBlur

fun(element: Element)?

Callback function when element loses focus

onEnter

fun(element: Element)?

Callback function when Enter key is pressed

onEvent

fun(element: Element, event: InputEvent)?

Callback function for interaction events

onFocus

fun(element: Element)?

Callback function when element receives focus

onTextChange

fun(element: Element, text: string)?

Callback function when text changes

onTextInput

fun(element: Element, text: string)?

Callback function for text input

opacity

number

overflow

string?

Overflow behavior for both axes

overflowX

string?

Overflow behavior for horizontal axis

overflowY

string?

Overflow behavior for vertical axis

padding

{ top: number, right: number, bottom: number, left: number }?

Padding around children (default: {top=0, right=0, bottom=0, left=0})

parent

Element?

Parent element (nil if top-level)

passwordMode

boolean

Whether to display text as password (default: false)

placeholder

string?

Placeholder text when empty (default: nil)

positioning

Positioning

Layout positioning mode (default: RELATIVE)

prevGameSize

{ width: number, height: number }

Previous game size for resize calculations

recalculateUnits

(method) Element:recalculateUnits(newViewportWidth: number, newViewportHeight: number)

removeChild

(method) Element:removeChild(child: Element)

Remove a specific child from this element

replaceText

(method) Element:replaceText(startPos: number, endPos: number, newText: string)

Replace text in range

@param startPos — Start position (inclusive)

@param endPos — End position (inclusive)

@param newText — Replacement text

resize

(method) Element:resize(newGameWidth: number, newGameHeight: number)

Resize element and its children based on game window size change

number?

Offset from right edge (CSS-style positioning)

rowGap

(string|number)?

Gap between grid rows

scaleCorners

number?

Scale multiplier for 9-patch corners/edges. E.g., 2 = 2x size (overrides theme setting)

scalingAlgorithm

("bilinear"|"nearest")?

Scaling algorithm for 9-patch corners: “nearest” (sharp/pixelated) or “bilinear” (smooth) (overrides theme setting)

scrollBy

(method) Element:scrollBy(dx?: number, dy?: number)

Scroll by delta amount (delegates to ScrollManager)

@param dx — X delta (nil for no change)

@param dy — Y delta (nil for no change)

scrollSpeed

number?

Scroll speed multiplier

scrollToBottom

(method) Element:scrollToBottom()

Scroll to bottom

scrollToLeft

(method) Element:scrollToLeft()

Scroll to left

scrollToRight

(method) Element:scrollToRight()

Scroll to right

scrollToTop

(method) Element:scrollToTop()

Scroll to top

scrollable

boolean

Whether text is scrollable (default: false for single-line, true for multi-line)

scrollbarColor

Color?

Scrollbar thumb color

scrollbarPadding

number?

Scrollbar padding from edges

scrollbarRadius

number?

Scrollbar corner radius

scrollbarTrackColor

Color?

Scrollbar track color

scrollbarWidth

number?

Scrollbar width in pixels

selectAll

(method) Element:selectAll()

Select all text

selectOnFocus

boolean

Whether to select all text on focus (default: false)

selectionColor

Color?

Selection background color (default: nil, uses theme or default)

setCursorPosition

(method) Element:setCursorPosition(position: number)

Set cursor position

@param position — Character index (0-based)

setScrollPosition

(method) Element:setScrollPosition(x?: number, y?: number)

Set scroll position with bounds clamping (delegates to ScrollManager)

@param x — X scroll position (nil to keep current)

@param y — Y scroll position (nil to keep current)

setSelection

(method) Element:setSelection(startPos: number, endPos: number)

Set selection range

@param startPos — Start position (inclusive)

@param endPos — End position (inclusive)

setText

(method) Element:setText(text: string)

Set text buffer and mark dirty

show

(method) Element:show()

same as calling updateOpacity(1)

text

string?

Text content to display in the element

textAlign

TextAlign

Alignment of the text content

textColor

Color

Color of the text content

textOverflow

"clip"|"ellipsis"|"scroll"

Text overflow behavior (default: “clip”)

textSize

number?

Resolved font size for text content in pixels

textWrap

boolean|"char"|"word"

Text wrapping mode (default: false for single-line, “word” for multi-line)

textinput

(method) Element:textinput(text: string)

Handle text input (character input)

@param text — Character(s) to insert

theme

string?

Theme component to use for rendering

themeComponent

string?

top

number?

Offset from top edge (CSS-style positioning)

transform

TransformProps

Transform properties for animations and styling

transition

TransitionProps

Transition settings for animations

units

table

Original unit specifications for responsive behavior

update

(method) Element:update(dt: number)

Update element (propagate to children)

updateOpacity

(method) Element:updateOpacity(newOpacity: number)

updateText

(method) Element:updateText(newText: string, autoresize?: boolean)

@param autoresize — default: false

userdata

table?

width

string|number

Width of the element

x

string|number

X coordinate of the element

y

string|number

Y coordinate of the element

z

number

Z-index for layering (default: 0)



⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


__index

Element

_blurInstance

table?

Internal: cached blur effect instance

_borderBoxHeight

number?

Internal: cached border-box height

_borderBoxWidth

number?

Internal: cached border-box width

_calculateScrollbarDimensions

(method) Element:_calculateScrollbarDimensions()
  -> table

Calculate scrollbar dimensions and positions (delegates to ScrollManager)

@return — {vertical: {visible, trackHeight, thumbHeight, thumbY}, horizontal: {visible, trackWidth, thumbWidth, thumbX}}

_contentHeight

number?

Internal: total content height

_contentWidth

number?

Internal: total content width

_cursorBlinkPauseTimer

number?

Internal: timer for how long cursor blink has been paused

_cursorBlinkPaused

boolean?

Internal: whether cursor blink is paused (e.g., while typing)

_cursorBlinkTimer

number?

Internal: cursor blink timer

_cursorColumn

number?

Internal: cursor column within line

_cursorLine

number?

Internal: cursor line number (1-based)

_cursorPosition

number?

Internal: cursor character position (0-based)

_cursorVisible

boolean?

Internal: cursor visibility state

_detectOverflow

(method) Element:_detectOverflow()

Detect if content overflows container bounds (delegates to ScrollManager)

_eventHandler

EventHandler

Event handler instance for input processing

_explicitlyAbsolute

boolean?

_focused

boolean?

Internal: focus state

_getFont

(method) Element:_getFont()
  -> love.Font

_getScrollbarAtPosition

(method) Element:_getScrollbarAtPosition(mouseX: number, mouseY: number)
  -> table|nil

Get scrollbar at mouse position (delegates to ScrollManager)

@return — {component: “vertical”|“horizontal”, region: “thumb”|“track”}

_handleScrollbarDrag

(method) Element:_handleScrollbarDrag(mouseX: number, mouseY: number)
  -> boolean

Handle scrollbar drag (delegates to ScrollManager)

@return — True if event was consumed

_handleScrollbarPress

(method) Element:_handleScrollbarPress(mouseX: number, mouseY: number, button: number)
  -> boolean

Handle scrollbar mouse press

@return — True if event was consumed

_handleScrollbarRelease

(method) Element:_handleScrollbarRelease(button: number)
  -> boolean

Handle scrollbar release (delegates to ScrollManager)

@return — True if event was consumed

_handleTextClick

(method) Element:_handleTextClick(mouseX: number, mouseY: number, clickCount: number)

Handle mouse click on text (set cursor position or start selection)

@param mouseX — Mouse X coordinate

@param mouseY — Mouse Y coordinate

@param clickCount — Number of clicks (1=single, 2=double, 3=triple)

_handleTextDrag

(method) Element:_handleTextDrag(mouseX: number, mouseY: number)

Handle mouse drag for text selection

@param mouseX — Mouse X coordinate

@param mouseY — Mouse Y coordinate

_handleWheelScroll

(method) Element:_handleWheelScroll(x: number, y: number)
  -> boolean

Handle mouse wheel scrolling (delegates to ScrollManager)

@param x — Horizontal scroll amount

@param y — Vertical scroll amount

@return — True if scroll was handled

_hoveredScrollbar

table?

Internal: currently hovered scrollbar info

_layoutEngine

LayoutEngine

Internal: LayoutEngine instance for layout calculations

_lines

table?

Internal: split lines for multi-line text

_loadedImage

(love.Image)?

Internal: cached loaded image

_maxScrollX

number?

Internal: maximum horizontal scroll

_maxScrollY

number?

Internal: maximum vertical scroll

_mouseDownPosition

number?

Internal: mouse down position for drag tracking

_originalPositioning

Positioning?

Original positioning value set by user

_overflowX

boolean?

Internal: whether content overflows horizontally

_overflowY

boolean?

Internal: whether content overflows vertically

_pressed

table?

Internal: button press state tracking

_renderer

Renderer

Internal: Renderer instance for visual rendering

_scrollManager

ScrollManager?

Internal: ScrollManager instance for scroll handling

_scrollX

number?

Internal: horizontal scroll position

_scrollY

number?

Internal: vertical scroll position

_scrollbarDragOffset

number?

Internal: scrollbar drag offset

_scrollbarDragging

boolean?

Internal: scrollbar dragging state

_scrollbarHoveredHorizontal

boolean?

Internal: horizontal scrollbar hover state

_scrollbarHoveredVertical

boolean?

Internal: vertical scrollbar hover state

_scrollbarPressHandled

boolean?

Internal: scrollbar press handled flag

_selectionAnchor

number?

Internal: selection anchor point

_selectionEnd

number?

Internal: selection end position

_selectionStart

number?

Internal: selection start position

_stateId

string?

State manager ID for this element

_syncScrollManagerState

(method) Element:_syncScrollManagerState()

Sync ScrollManager state to Element properties for backward compatibility This ensures Renderer and StateManager can access scroll state from Element

_textBuffer

string?

Internal: text buffer for editable elements

_textDirty

boolean?

Internal: flag to recalculate lines/wrapping

_textDragOccurred

boolean?

Internal: whether text drag occurred

_textEditor

TextEditor?

Internal: TextEditor instance for editable elements

_themeManager

ThemeManager

Internal: theme manager instance

_themeState

string?

Current theme state (normal, hover, pressed, active, disabled)

_wrapLine

(method) Element:_wrapLine(line: string, maxWidth: number)
  -> table

Wrap a single line of text

@param line — Line to wrap

@param maxWidth — Maximum width in pixels

@return — Array of wrapped line parts

_wrappedLines

table?

Internal: wrapped line data

ElementProps

active

boolean?

Whether the element is active/focused (for inputs, default: false)

alignContent

AlignContent?

Alignment of lines in multi-line flex containers (default: STRETCH)

alignItems

AlignItems?

Alignment of items along cross axis (default: STRETCH)

alignSelf

AlignSelf?

Alignment of the item itself along cross axis (default: AUTO)

autoGrow

boolean?

Whether element auto-grows with text (default: false for single-line, true for multi-line)

autoScaleText

boolean?

Whether text should auto-scale with window size (default: true)

backdropBlur

{ intensity: number, quality: number }?

Blur content behind the element (intensity: 0-100, quality: 1-10, default: nil)

backgroundColor

Color?

Background color (default: transparent)

border

Border?

Border configuration for the element

borderColor

Color?

Color of the border (default: black)

bottom

(string|number)?

Offset from bottom edge (CSS-style positioning)

columnGap

(string|number)?

Gap between grid columns (default: 0)

contentAutoSizingMultiplier

{ width: number?, height: number? }?

Multiplier for auto-sized content dimensions (default: sourced from theme or {1, 1})

contentBlur

{ intensity: number, quality: number }?

Blur the element’s content including children (intensity: 0-100, quality: 1-10, default: nil)

cornerRadius

(number|{ topLeft: number?, topRight: number?, bottomLeft: number?, bottomRight: number? })?

Corner radius: number (all corners) or table for individual corners (default: 0)

cursorBlinkRate

number?

Cursor blink rate in seconds (default: 0.5)

cursorColor

Color?

Cursor color (default: nil, uses textColor)

disableHighlight

boolean?

Whether to disable the pressed state highlight overlay (default: false, or true when using themeComponent)

disabled

boolean?

Whether the element is disabled (default: false)

editable

boolean?

Whether the element is editable (default: false)

flexDirection

FlexDirection?

Direction of flex layout: “horizontal”|“vertical” (default: HORIZONTAL)

flexWrap

FlexWrap?

Whether children wrap to multiple lines: “nowrap”|“wrap”|“wrap-reverse” (default: NOWRAP)

fontFamily

string?

Font family name from theme or path to font file (default: theme default or system default, inherits from parent)

gap

(string|number)?

Space between children elements (default: 0)

gridColumns

number?

Number of columns in the grid (default: 1)

gridRows

number?

Number of rows in the grid (default: 1)

height

(string|number)?

Height of the element (default: calculated automatically)

hideScrollbars

(boolean|{ vertical: boolean, horizontal: boolean })?

Hide scrollbars (boolean for both, or table for individual control, default: false)

id

string?

Unique identifier for the element (auto-generated in immediate mode if not provided)

image

(love.Image)?

Image object to display

imageOpacity

number?

Image opacity 0-1 (default: 1, combines with element opacity)

imagePath

string?

Path to image file (auto-loads via ImageCache)

inputType

("email"|"number"|"text"|"url")?

Input type for validation (default: “text”)

justifyContent

JustifyContent?

Alignment of items along main axis (default: FLEX_START)

justifySelf

JustifySelf?

Alignment of the item itself along main axis (default: AUTO)

left

(string|number)?

Offset from left edge (CSS-style positioning)

margin

{ top: (string|number)?, right: (string|number)?, bottom: (string|number)?, left: (string|number)?, horizontal: (string|number)?, vertical: (string|number)? }?

Margin around element (default: {top=0, right=0, bottom=0, left=0})

maxLength

number?

Maximum text length in characters (default: nil)

maxLines

number?

Maximum number of lines (default: nil)

maxTextSize

number?

Maximum text size in pixels for auto-scaling

minTextSize

number?

Minimum text size in pixels for auto-scaling

multiline

boolean?

Whether the element supports multiple lines (default: false)

objectFit

("contain"|"cover"|"fill"|"none"|"scale-down")?

Image fit mode (default: “fill”)

objectPosition

string?

Image position like “center center”, “top left”, “50% 50%” (default: “center center”)

onBlur

fun(element: Element, event: InputEvent)?

Callback when element loses focus

onEnter

fun(element: Element)?

Callback when Enter key is pressed

onEvent

fun(element: Element, event: InputEvent)?

Callback function for interaction events

onFocus

fun(element: Element, event: InputEvent)?

Callback when element receives focus

onTextChange

fun(element: Element, text: string)?

Callback when text content changes

onTextInput

fun(element: Element, text: string)?

Callback when text is input

opacity

number?

Element opacity 0-1 (default: 1)

overflow

("auto"|"hidden"|"scroll"|"visible")?

Overflow behavior (default: “hidden”)

overflowX

("auto"|"hidden"|"scroll"|"visible")?

X-axis overflow (overrides overflow)

overflowY

("auto"|"hidden"|"scroll"|"visible")?

Y-axis overflow (overrides overflow)

padding

{ top: (string|number)?, right: (string|number)?, bottom: (string|number)?, left: (string|number)?, horizontal: (string|number)?, vertical: (string|number)? }?

Padding around children (default: {top=0, right=0, bottom=0, left=0})

parent

Element?

Parent element for hierarchical structure

passwordMode

boolean?

Whether to display text as password (default: false, disables multiline)

placeholder

string?

Placeholder text when empty (default: nil)

positioning

Positioning?

Layout positioning mode: “absolute”|“relative”|“flex”|“grid” (default: RELATIVE)

right

(string|number)?

Offset from right edge (CSS-style positioning)

rowGap

(string|number)?

Gap between grid rows (default: 0)

scaleCorners

number?

Scale multiplier for 9-patch corners/edges. E.g., 2 = 2x size (overrides theme setting)

scalingAlgorithm

("bilinear"|"nearest")?

Scaling algorithm for 9-patch corners: “nearest” (sharp/pixelated) or “bilinear” (smooth) (overrides theme setting)

scrollSpeed

number?

Pixels per wheel notch (default: 20)

scrollable

boolean?

Whether text is scrollable (default: false for single-line, true for multi-line)

scrollbarColor

Color?

Scrollbar thumb color (default: Color.new(0.5, 0.5, 0.5, 0.8))

scrollbarPadding

number?

Padding between scrollbar and edge (default: 2)

scrollbarRadius

number?

Corner radius for scrollbar (default: 6)

scrollbarTrackColor

Color?

Scrollbar track color (default: Color.new(0.2, 0.2, 0.2, 0.5))

scrollbarWidth

number?

Width of scrollbar track in pixels (default: 12)

selectOnFocus

boolean?

Whether to select all text on focus (default: false)

selectionColor

Color?

Selection background color (default: nil, uses theme or default)

text

string?

Text content to display (default: nil)

textAlign

TextAlign?

Alignment of the text content (default: START)

textColor

Color?

Color of the text content (default: black or theme text color)

textOverflow

("clip"|"ellipsis"|"scroll")?

Text overflow behavior (default: “clip”)

textSize

(string|number)?

Font size: number (px), string with units (“2vh”, “10%”), or preset (“xxs”|“xs”|“sm”|“md”|“lg”|“xl”|“xxl”|“3xl”|“4xl”) (default: “md” or 12px)

textWrap

(boolean|"char"|"word")?

Text wrapping mode (default: false for single-line, “word” for multi-line)

theme

string?

Theme name to use (e.g., “space”, “metal”). Defaults to theme from flexlove.init()

themeComponent

string?

Theme component to use (e.g., “panel”, “button”, “input”). If nil, no theme is applied

top

(string|number)?

Offset from top edge (CSS-style positioning)

transform

TransformProps?

Transform properties for animations and styling

transition

TransitionProps?

Transition settings for animations

userdata

table?

User-defined data storage for custom properties

width

(string|number)?

Width of the element (default: calculated automatically)

x

(string|number)?

X coordinate of the element (default: 0)

y

(string|number)?

Y coordinate of the element (default: 0)

z

number?

Z-index for layering (default: 0)



⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


_scrollX

number?

Internal: scroll X position (restored in immediate mode)

_scrollY

number?

Internal: scroll Y position (restored in immediate mode)

EventHandler

getState

(method) EventHandler:getState()
  -> State: table

Get state for persistence (for immediate mode)

@return State — data

initialize

(method) EventHandler:initialize(element: Element)

Initialize EventHandler with parent element reference

@param element — The parent element

isAnyButtonPressed

(method) EventHandler:isAnyButtonPressed()
  -> True: boolean

Check if any mouse button is pressed

@return True — if any button is pressed

isButtonPressed

(method) EventHandler:isButtonPressed(button: number)
  -> True: boolean

Check if a specific button is pressed

@param button — Mouse button (1=left, 2=right, 3=middle)

@return True — if button is pressed

new

function EventHandler.new(config: table, deps: table)
  -> EventHandler

Create a new EventHandler instance

@param config — Configuration options

@param deps — Dependencies {InputEvent, Context, utils}

onEvent

fun(element: Element, event: InputEvent)?

processMouseEvents

(method) EventHandler:processMouseEvents(mx: number, my: number, isHovering: boolean, isActiveElement: boolean)

Process mouse button events in the update cycle

@param mx — Mouse X position

@param my — Mouse Y position

@param isHovering — Whether mouse is over element

@param isActiveElement — Whether this is the top element at mouse position

processTouchEvents

(method) EventHandler:processTouchEvents()

Process touch events in the update cycle

resetScrollbarPressFlag

(method) EventHandler:resetScrollbarPressFlag()

Reset scrollbar press flag (called each frame)

setState

(method) EventHandler:setState(state: table)

Restore state from persistence (for immediate mode)

@param state — State data



⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


_Context

table

_InputEvent

table

__index

EventHandler

_clickCount

number

_dragStartX

table<number, number>

_dragStartY

table<number, number>

_element

Element?

_handleMouseDrag

(method) EventHandler:_handleMouseDrag(mx: number, my: number, button: number, isHovering: boolean)

Handle mouse drag (while button is pressed and mouse moves)

@param mx — Mouse X position

@param my — Mouse Y position

@param button — Mouse button

@param isHovering — Whether mouse is over element

_handleMousePress

(method) EventHandler:_handleMousePress(mx: number, my: number, button: number)

Handle mouse button press

@param mx — Mouse X position

@param my — Mouse Y position

@param button — Mouse button (1=left, 2=right, 3=middle)

_handleMouseRelease

(method) EventHandler:_handleMouseRelease(mx: number, my: number, button: number)

Handle mouse button release

@param mx — Mouse X position

@param my — Mouse Y position

@param button — Mouse button

_hovered

boolean

_lastClickButton

number?

_lastClickTime

number?

_lastMouseX

table<number, number>

_lastMouseY

table<number, number>

_pressed

table<number, boolean>

_scrollbarPressHandled

boolean

_touchPressed

table<number, boolean>

_utils

table

FlexLove

Animation

Animation

Color

Color

Utility class for color handling

Theme

Theme

baseScale

table

beginFrame

function FlexLove.beginFrame()

Begin a new immediate mode frame

clearAllStates

function FlexLove.clearAllStates()

Clear all immediate mode states

clearState

function FlexLove.clearState(id: string)

Clear state for a specific element ID

defaultTheme

(string|ThemeDefinition)?

destroy

function FlexLove.destroy()

draw

function FlexLove.draw(gameDrawFunc: function|nil, postDrawFunc: function|nil)

endFrame

function FlexLove.endFrame()

enums

unknown

getElementAtPosition

function FlexLove.getElementAtPosition(x: number, y: number)
  -> Element?

Find the topmost element at given coordinates

getMode

function FlexLove.getMode()
  -> "immediate"|"retained"
return #1:
    | "immediate"
    | "retained"

getStateCount

function FlexLove.getStateCount()
  -> number

getStateStats

function FlexLove.getStateStats()
  -> table

Get state statistics (for debugging)

init

function FlexLove.init(config: { baseScale: { width: number?, height: number? }?, theme: (string|ThemeDefinition)?, immediateMode: boolean?, stateRetentionFrames: number?, maxStateEntries: number?, autoFrameManagement: boolean? })

keypressed

function FlexLove.keypressed(key: string, scancode: string, isrepeat: boolean)

new

function FlexLove.new(props: ElementProps)
  -> Element

resize

function FlexLove.resize()

scaleFactors

table

setMode

function FlexLove.setMode(mode: "immediate"|"retained")
mode:
    | "immediate"
    | "retained"

textinput

function FlexLove.textinput(text: string)

topElements

table

update

function FlexLove.update(dt: any)

wheelmoved

function FlexLove.wheelmoved(dx: any, dy: any)


⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


_DESCRIPTION

string

_LICENSE

string

_URL

string

_VERSION

string

Add version and metadata

_activeEventElement

Element?

_autoBeganFrame

boolean

_autoFrameManagement

boolean

_backdropCanvas

nil

A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as “render to texture”.

By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.

In versions prior to love.graphics.isSupported(“canvas”) could be used to check for support at runtime.

Open in Browser

_cachedViewport

table

_canvasDimensions

table

_currentFrameElements

table

_focusedElement

nil

_frameNumber

integer

_frameStarted

boolean

_gameCanvas

nil

A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as “render to texture”.

By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.

In versions prior to love.graphics.isSupported(“canvas”) could be used to check for support at runtime.

Open in Browser

_immediateMode

boolean

_immediateModeState

unknown

FontFamily

path

string

Path to the font file (relative to FlexLove or absolute)



⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


_loadedFont

(love.Font)?

Internal: cached loaded font

InputEvent

button

number

Mouse button: 1 (left), 2 (right), 3 (middle)

clickCount

number

Number of clicks (for double/triple click detection)

dx

number?

Delta X from drag start (only for drag events)

dy

number?

Delta Y from drag start (only for drag events)

modifiers

{ shift: boolean, ctrl: boolean, alt: boolean, super: boolean }

new

function InputEvent.new(props: InputEventProps)
  -> InputEvent

Create a new input event

timestamp

number

Time when event occurred

type

"click"|"drag"|"middleclick"|"press"|"release"...(+1)

x

number

Mouse X position

y

number

Mouse Y position



⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


__index

InputEvent

TextEditor

allowNewlines

boolean

allowTabs

boolean

autoGrow

boolean

blur

(method) TextEditor:blur()

Remove focus from this element

clearSelection

(method) TextEditor:clearSelection()

Clear selection

cursorBlinkRate

number

cursorColor

Color?

Utility class for color handling

customSanitizer

function?

deleteSelection

(method) TextEditor:deleteSelection()
  -> boolean

Delete selected text

@return — True if text was deleted

deleteText

(method) TextEditor:deleteText(startPos: number, endPos: number)

Delete text in range

@param startPos — Start position (inclusive)

@param endPos — End position (inclusive)

editable

boolean

focus

(method) TextEditor:focus()

Focus this element for keyboard input

getCursorPosition

(method) TextEditor:getCursorPosition()
  -> number

Get cursor position

@return — Character index (0-based)

getSelectedText

(method) TextEditor:getSelectedText()
  -> string?

Get selected text

@return — Selected text or nil if no selection

getSelection

(method) TextEditor:getSelection()
  -> number?
  2. number?

Get selection range

@return — Start and end positions, or nil if no selection

getText

(method) TextEditor:getText()
  -> string

Get current text buffer

handleKeyPress

(method) TextEditor:handleKeyPress(key: string, scancode: string, isrepeat: boolean)

Handle key press (special keys)

@param key — Key name

@param scancode — Scancode

@param isrepeat — Whether this is a key repeat

handleTextClick

(method) TextEditor:handleTextClick(mouseX: number, mouseY: number, clickCount: number)

Handle mouse click on text

@param clickCount — 1=single, 2=double, 3=triple

handleTextDrag

(method) TextEditor:handleTextDrag(mouseX: number, mouseY: number)

Handle mouse drag for text selection

handleTextInput

(method) TextEditor:handleTextInput(text: string)

Handle text input (character insertion)

hasSelection

(method) TextEditor:hasSelection()
  -> boolean

Check if there is an active selection

initialize

(method) TextEditor:initialize(element: table)

Initialize TextEditor with parent element reference

@param element — The parent Element instance

inputType

"email"|"number"|"text"|"url"

insertText

(method) TextEditor:insertText(text: string, position?: number, skipSanitization?: boolean)

Insert text at position

@param text — Text to insert

@param position — Position to insert at (default: cursor position)

@param skipSanitization — Skip sanitization (for internal use)

isFocused

(method) TextEditor:isFocused()
  -> boolean

Check if this element is focused

maxLength

number?

maxLines

number?

mouseToTextPosition

(method) TextEditor:mouseToTextPosition(mouseX: number, mouseY: number)
  -> number

Convert mouse coordinates to cursor position in text

@param mouseX — Mouse X coordinate (absolute)

@param mouseY — Mouse Y coordinate (absolute)

@return — Cursor position (character index)

moveCursorBy

(method) TextEditor:moveCursorBy(delta: number)

Move cursor by delta characters

@param delta — Number of characters to move (positive or negative)

moveCursorToEnd

(method) TextEditor:moveCursorToEnd()

Move cursor to end of text

moveCursorToLineEnd

(method) TextEditor:moveCursorToLineEnd()

Move cursor to end of current line

moveCursorToLineStart

(method) TextEditor:moveCursorToLineStart()

Move cursor to start of current line

moveCursorToNextWord

(method) TextEditor:moveCursorToNextWord()

Move cursor to start of next word

moveCursorToPreviousWord

(method) TextEditor:moveCursorToPreviousWord()

Move cursor to start of previous word

moveCursorToStart

(method) TextEditor:moveCursorToStart()

Move cursor to start of text

multiline

boolean

new

function TextEditor.new(config: TextEditorConfig, deps: table)
  -> TextEditor: table

Create a new TextEditor instance

@param deps — Dependencies {Context, StateManager, Color, utils}

@return TextEditor — instance

onBlur

fun(element: Element)?

onEnter

fun(element: Element)?

onFocus

fun(element: Element)?

onSanitize

fun(element: Element, original: string, sanitized: string)?

onTextChange

fun(element: Element, text: string)?

onTextInput

fun(element: Element, text: string)?

passwordMode

boolean

placeholder

string?

replaceText

(method) TextEditor:replaceText(startPos: number, endPos: number, newText: string)

Replace text in range

@param startPos — Start position (inclusive)

@param endPos — End position (inclusive)

@param newText — Replacement text

sanitize

boolean

scrollable

boolean

selectAll

(method) TextEditor:selectAll()

Select all text

selectOnFocus

boolean

selectionColor

Color?

Utility class for color handling

setCursorPosition

(method) TextEditor:setCursorPosition(position: number)

Set cursor position

@param position — Character index (0-based)

setSelection

(method) TextEditor:setSelection(startPos: number, endPos: number)

Set selection range

@param startPos — Start position (inclusive)

@param endPos — End position (inclusive)

setText

(method) TextEditor:setText(text: string, skipSanitization?: boolean)

Set text buffer and mark dirty

@param skipSanitization — Skip sanitization (for trusted input)

textOverflow

"clip"|"ellipsis"|"scroll"

textWrap

boolean|"char"|"word"

update

(method) TextEditor:update(dt: number)

Update cursor blink animation

@param dt — Delta time

updateAutoGrowHeight

(method) TextEditor:updateAutoGrowHeight()

Update element height based on text content (for autoGrow)



⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


_Color

table

_Context

table

_FONT_CACHE

table

_StateManager

table

__index

TextEditor

_calculateWrapping

(method) TextEditor:_calculateWrapping()

Calculate text wrapping

_cursorBlinkPauseTimer

number

_cursorBlinkPaused

boolean

_cursorBlinkTimer

number

_cursorColumn

number

_cursorLine

number

_cursorPosition

number

_cursorVisible

boolean

_element

Element?

_focused

boolean

_getCursorScreenPosition

(method) TextEditor:_getCursorScreenPosition()
  -> number
  2. number

Get cursor screen position for rendering (handles multiline text)

@return — Cursor X and Y position relative to content area

_getFont

(method) TextEditor:_getFont()
  -> (love.Font)?

Get font for text rendering

_getModifiers

function

_getSelectionRects

(method) TextEditor:_getSelectionRects(selStart: number, selEnd: number)
  -> table

Get selection rectangles for rendering

@param selStart — Selection start position

@param selEnd — Selection end position

@return — Array of rectangles {x, y, width, height}

_lines

table?

_markTextDirty

(method) TextEditor:_markTextDirty()

Mark text as dirty (needs recalculation)

_mouseDownPosition

number
(method) TextEditor:_resetCursorBlink(pauseBlink: boolean|nil)

Reset cursor blink (show cursor immediately)

@param pauseBlink — Whether to pause blinking (for typing)

_sanitizeText

(method) TextEditor:_sanitizeText(text: string)
  -> string

Internal: Sanitize text input

@param text — Text to sanitize

@return — Sanitized text

_saveState

(method) TextEditor:_saveState()

Save state to StateManager (for immediate mode)

_selectWordAtPosition

(method) TextEditor:_selectWordAtPosition(position: number)

Select word at given position

_selectionAnchor

number?

_selectionEnd

number?

_selectionStart

number?

_splitLines

(method) TextEditor:_splitLines()

Split text into lines (for multi-line text)

_textBuffer

string

_textDirty

boolean

_textDragOccurred

boolean?

_textScrollX

number

_updateTextIfDirty

(method) TextEditor:_updateTextIfDirty()

Update text if dirty (recalculate lines and wrapping)

_updateTextScroll

(method) TextEditor:_updateTextScroll()

Update text scroll offset to keep cursor visible

_utils

table

_validateCursorPosition

(method) TextEditor:_validateCursorPosition()

Validate cursor position (ensure it’s within text bounds)

_wrapLine

(method) TextEditor:_wrapLine(line: string, maxWidth: number)
  -> table

Wrap a single line of text

@param line — Line to wrap

@param maxWidth — Maximum width in pixels

@return — Array of wrapped line parts

_wrappedLines

table?

TextEditorConfig

allowNewlines

boolean?

Whether to allow newline characters (default: true in multiline)

allowTabs

boolean?

Whether to allow tab characters (default: true)

autoGrow

boolean

Whether element auto-grows with text

cursorBlinkRate

number

Cursor blink rate in seconds

cursorColor

Color?

Cursor color

customSanitizer

function?

Custom sanitization function

editable

boolean

Whether text is editable

inputType

"email"|"number"|"text"|"url"

Input validation type

maxLength

number?

Maximum text length in characters

maxLines

number?

Maximum number of lines

multiline

boolean

Whether multi-line is supported

passwordMode

boolean

Whether to mask text

placeholder

string?

Placeholder text when empty

sanitize

boolean?

Whether to sanitize text input (default: true)

scrollable

boolean

Whether text is scrollable

selectOnFocus

boolean

Whether to select all text on focus

selectionColor

Color?

Selection background color

textOverflow

"clip"|"ellipsis"|"scroll"

Text overflow behavior

textWrap

boolean|"char"|"word"

Text wrapping mode


Theme

Manager

ThemeManager

Export both Theme and ThemeManager

atlas

(love.Image)?

Optional: global atlas

atlasData

(love.ImageData)?

Raw (decoded) image data.

You can’t draw ImageData directly to screen. See Image for that.

Open in Browser

colors

table<string, Color>

components

table<string, ThemeComponent>

contentAutoSizingMultiplier

{ width: number?, height: number? }?

Optional: default multiplier for auto-sized content dimensions

fonts

table<string, string>

Font family definitions

get

function Theme.get(themeName: string)
  -> Theme|nil

Get a theme by name

@param themeName — Name of the theme

@return — Returns theme or nil if not found

getActive

function Theme.getActive()
  -> Theme?

Get the active theme

getAllColors

function Theme.getAllColors()
  -> table<string, Color>|nil

Get all colors from the active theme

@return — Table of all colors, or nil if no theme active

getColor

function Theme.getColor(colorName: string)
  -> Color?

Get a color from the active theme

@param colorName — Name of the color (e.g., “primary”, “secondary”)

@return — Returns Color instance or nil if not found

getColorNames

function Theme.getColorNames()
  -> table<string>|nil

Get all available color names from the active theme

@return — Array of color names, or nil if no theme active

getColorOrDefault

function Theme.getColorOrDefault(colorName: string, fallback: Color|nil)
  -> Color

Get a color with a fallback if not found

@param colorName — Name of the color to retrieve

@param fallback — Fallback color if not found (default: white)

@return — The color or fallback

getComponent

function Theme.getComponent(componentName: string, state?: string)
  -> ThemeComponent?

Get a component from the active theme

@param componentName — Name of the component (e.g., “button”, “panel”)

@param state — Optional state (e.g., “hover”, “pressed”, “disabled”)

@return — Returns component or nil if not found

getFont

function Theme.getFont(fontName: string)
  -> string?

Get a font from the active theme

@param fontName — Name of the font family (e.g., “default”, “heading”)

@return — Returns font path or nil if not found

getRegisteredThemes

function Theme.getRegisteredThemes()
  -> table<string>

Get all registered theme names

@return — Array of theme names

hasActive

function Theme.hasActive()
  -> boolean

Check if a theme is currently active

@return — Returns true if a theme is active

load

function Theme.load(path: string)
  -> Theme

Load a theme from a Lua file

@param path — Path to theme definition file (e.g., “space” or “mytheme”)

name

string

new

function Theme.new(definition: any)
  -> Theme

sanitizeTheme

function Theme.sanitizeTheme(theme?: table)
  -> sanitized: table

Sanitize a theme definition by removing invalid values and providing defaults

@param theme — The theme to sanitize

@return sanitized — The sanitized theme

setActive

function Theme.setActive(themeOrName: string|Theme)

validateTheme

function Theme.validateTheme(theme?: table, options?: table)
  -> valid: boolean
  2. errors: table

Validate a theme definition for structural correctness (non-aggressive)

@param theme — The theme to validate

@param options — Optional validation options {strict: boolean}

@return valid,errors — List of validation errors



⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


__index

Theme

ThemeComponent

atlas

(string|love.Image)?

Optional: component-specific atlas (overrides theme atlas). Files ending in .9.png are auto-parsed

contentAutoSizingMultiplier

{ width: number?, height: number? }?

Optional: multiplier for auto-sized content dimensions

insets

{ left: number, top: number, right: number, bottom: number }?

Optional: 9-patch insets (auto-extracted from .9.png files or manually defined)

regions

{ topLeft: ThemeRegion, topCenter: ThemeRegion, topRight: ThemeRegion, middleLeft: ThemeRegion, middleCenter: ThemeRegion, middleRight: ThemeRegion, bottomLeft: ThemeRegion, bottomCenter: ThemeRegion, bottomRight: ThemeRegion }

scaleCorners

number?

Optional: scale multiplier for non-stretched regions (corners/edges). E.g., 2 = 2x size. Default: nil (no scaling)

scalingAlgorithm

("bilinear"|"nearest")?

Optional: scaling algorithm for non-stretched regions. Default: “bilinear”

states

table<string, ThemeComponent>?

stretch

{ horizontal: table<integer, string>, vertical: table<integer, string> }


⚠️ Internal Properties

Warning: The following properties are internal implementation details and should not be accessed directly. They are prefixed with _ to indicate they are private. Accessing these properties may break in future versions without notice.


_loadedAtlas

(string|love.Image)?

Internal: cached loaded atlas image

_loadedAtlasData

(love.ImageData)?

Internal: cached loaded atlas ImageData for pixel access

_ninePatchData

{ insets: table, contentPadding: table, stretchX: table, stretchY: table }?

Internal: parsed 9-patch data with stretch regions and content padding

_scaledRegionCache

table<string, love.Image>?

Internal: cache for scaled corner/edge images

ThemeDefinition

atlas

(string|love.Image)?

Optional: global atlas (can be overridden per component)

colors

table<string, Color>?

components

table<string, ThemeComponent>

contentAutoSizingMultiplier

{ width: number?, height: number? }?

Optional: default multiplier for auto-sized content dimensions

fonts

table<string, string>?

Optional: font family definitions (name -> path)

name

string

TransformProps

rotate

number?

scale

{ x: number, y: number }?

skew

{ x: number, y: number }?

translate

{ x: number, y: number }?

TransitionProps

duration

number?

easing

string?

↑ Top