Skip to content

lvgl.rectangle

lvgl.rectangle([parent, ]params)

Display a rectangle. Based on lvgl.box, so all lvgl.box settings also apply.

Parameters

NameReqTypeDescription
parentnoobjectoptional LVGL object to attach the new object to; if omitted the object is created in the top-level script window
paramsyestable
FieldTypeDescription
xnumberposition relative to the top-left of the parent
ynumberposition relative to the top-left of the parent
wnumberwidth
hnumberheight
colorcolor or functionprimary color for the object
posfunctiondynamic position callback returning x, y
sizefunctiondynamic size callback returning w, h
visiblefunctiondynamic visibility callback
floatingbooleankeep the object fixed inside a scrollable container, added in 2.11.6, defaults to false
thicknessnumberwidth of the border line, defaults to 1
filledboolean or functionif true the rectangle is filled with color, defaults to false (function support added in 2.11.4)
roundednumberif greater than 0, rounds the corners with this radius; must be >= thickness if set, defaults to 0
opacitynumber or functionopacity from 0 (transparent) to 255 (opaque), defaults to 255

Returns

Name Type Description
- table LVGL object

Availability

  • Since: 2.11.0
  • Radio support: color-lcd

Notes

  • When used in a stand alone tool script, the rectangle automatically adds scroll bars if any child objects are placed outside its boundaries. For widgets, child objects outside the bounds are clipped instead.

Source

radio/src/lua/api_colorlcd_lvgl.cpp