Class widget:box

Box widget
This module is only available from the UI process Lua state.

The box widget allows stacking widgets horizontally or vertically.


box:pack (child, options)

Add a widget to the box. There are several valid options that can be set in an options table:

  • from: whether to add child to the start or the end of the box. Can be "start" or "end".
  • expand: whether the new child should be assigned any extra space; such space is divided among all children with expand set to true.
  • fill: if true, the child will expand to fill any extra space assigned to it; otherwise, the child will be centered within the extra space.
  • padding: Extra space to put between the new child and its neighbors or the ends of the box widget, in pixels.


  • child
    Type: widget
    The widget to add as a new child.
  • options
    Type: table or nil
    Table of options.

box:reorder_child (child, position)

Rearrange a widget already in the box.


  • child
    Type: widget
    The child widget to reorder.
  • position
    Type: integer
    The position to move the widget to.



Type: boolean
Default: false
Whether the child widgets should all have the same size.


Type: number
Default: 0
The amount of space between each of the child widgets. Must be non-negative.

Type: string or nil
The background color of the box widget.