optional LVGL object to attach the new object to; if omitted the object is created in the top-level script window
params
yes
table
Field
Type
Description
x
number
position relative to the top-left of the parent
y
number
position relative to the top-left of the parent
w
number
width
h
number
height
color
color or function
primary color for the object
pos
function
dynamic position callback returning x, y
size
function
dynamic size callback returning w, h
visible
function
dynamic visibility callback
floating
boolean
keep the object fixed inside a scrollable container, added in 2.11.6, defaults to false
flexFlow
lvgl.FLOW_COLUMN or lvgl.FLOW_ROW
enables flex layout for this box, not used by default
flexPad
number
padding between rows/columns when flex layout is used; recommend using lvgl.PAD_xxx values, defaults to PAD_OUTLINE
scrollBar
boolean
enables/disables scroll bars, defaults to true
scrollDir
lvgl.SCROLL_xx
allowed scroll directions when child objects extend past the box bounds (stand alone scripts only), defaults to lvgl.SCROLL_ALL
scrolled
function
called when the box content is scrolled; passed x, y of the current scroll position, defaults to nil
scrollTo
function
overrides the box scroll position; must return x, y to scroll to, defaults to nil
align
alignment type (LEFT, RIGHT, CENTER, VTOP, VBOTTOM, VCENTER
) alignment used with flex layouts (added in 2.11.4); avoid combining an alignment with a scrollbar on the same axis, defaults to CENTER | VTOP
borderPad
number or table
border padding around the container edges; a single number applies to all sides, or a table {left=?, right=?, top=?, bottom=?} (added in 2.11.5), defaults to PAD_OUTLINE if flexFlow is set, otherwise 0
The box is a helper for managing screen layouts. @notice When adding controls such as button/toggle/textEdit, leave enough space around them for the focus outline. @notice In a stand alone tool script, the box automatically adds scroll bars if child objects fall outside its boundaries; for widgets, out-of-bounds children are clipped instead. @notice scrollBar, scrollDir, scrolled, and scrollTo were added in 2.11.2.