widget:box - Luakit

# Luakit Documentation / Classes / widget:box

# 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.

## Methods

### 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.

#### Parameters

- 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.

#### Parameters

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

## Properties

### box.homogeneous

Type: boolean
Default: `false`
Read-write
Whether the child widgets should all have the same size.

### box.spacing

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

### box.bg

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

## Attribution

#### Copyright

- 2010 Mason Larobina