Page icon

inline Layout

The inline layout arranges components horizontally or vertically.

{
  "type": "view",
  "layout": "inline",
  "direction": "horizontal",
  "spacing": 4,
  "components": [
    {
      "type": "button",
      "text": "first"
    },
    {
      "type": "button",
      "text": "second"
    },
    {
      "type": "button",
      "text": "third"
    }
  ]
}

Components are laid out sequentially taking into account spacing.

Properties

direction
ENUM
Default: "horizontal"

The direction of layout for the inline layout.

Value Description
"horizontal" Lay the components out horizontally. The desired height of the layout will be based on the tallest component.
"vertical" Lay the components out vertically. The desired width of the layout will be based on the widest component.
padding
INTEGER
Default: 0, Range: 0-64

Inset the content around the perimeter of the view by the padding amount.

spacing
INTEGER
Default: 0, Range: 0-64

Add spacing between the components in the view.

Constraints

Each component can use the shared constraints to refine their position within the layout.

Using additional constraints such as position and stretch is where the inline layout comes alive.

Resizing Behaviour

When direction is horizontal, components will assume their desired width, and fill the height of the layout.

When direction is set to vertical, components will assume their desired height, and fill the width of the layout.

This behaviour can be modified using the shared constraints