Writing a Layout File

General Syntax

Each layout file must have one root widget, typically a FlexContainer. Widgets and type values are declared using a constructor-like syntax:

WidgetName(
    property_name = value,
    another_property = true,
    nested_property = TypeValueName(
        type_value_property = 5,
    )
)

You can include trailing commas for readability. If a widget or type value has default properties, they can be omitted:

Image()

Adding Child Widgets

To nest widgets, use the children property inside a FlexContainer:

FlexContainer() {
    Text(kind = title)
    Image()
}

Child widgets are enclosed in curly braces, with whitespace separating them.


Widget Properties

FlexContainer

The FlexContainer organizes its child widgets either horizontally or vertically.

PropertyDescriptionTypeDefault
directionLayout direction (horizontal or vertical).Literal-
max_widthMaximum width of the container.UIntMAX
max_heightMaximum height of the container.UIntMAX
borderBorder around the container.BorderDefault border values
spacingSpacing between child widgets.SpacingDefault spacing values
alignmentHorizontal and vertical alignment of content (start, center, end).Alignment-
transparent_backgroundMake the background transparent (true or false)Literalfalse

Text

The Text widget is used for titles and body text. Specify the kind of text to display.

PropertyDescriptionTypeDefault
kindType of text (title/summary or body).Literal-

Image

The Image widget displays an image. It uses properties defined in the main configuration.


Supporting Type Values

Spacing

Defines padding or margin offsets. Currently, individual values (e.g., top, right) must be set explicitly.

PropertyDescriptionTypeDefault
topOffset from the top.UInt0
rightOffset from the right.UInt0
bottomOffset from the bottom.UInt0
leftOffset from the left.UInt0

Alignment

Controls how content is aligned within a widget.

PropertyDescriptionTypeDefault
horizontalHorizontal alignment (start, end, center, space-between).Literal-
verticalVertical alignment (start, end, center, space-between).Literal-