Files
Basalt/docs/objects/Flexbox.md
2023-05-08 07:00:28 +10:00

1.1 KiB

A Flexbox is a layout container that is designed to make it easier to create flexible and responsive UI designs. It allows you to arrange and align its children (elements) within it in a more efficient way.

In addition to the methods inherited from Frame, Container, VisualObject and Object, Flexbox has the following methods:

setSpacing Sets the space between objects
getSpacing Returns the space between objects
setFlexDirection Sets the direction in which the children will be placed
setJustifyContent Determines how the children are aligned along the main axis

Example

Here's an example of how to create a Flexbox object:

local main = basalt.createFrame()
local flexbox = main:addFlexbox()
  :setFlexDirection("column")
  :setJustifyContent("space-between")
  :setSpacing(5)

Alternatively, you can create a flexbox using an XML layout:

<flexbox flexDirection="column" justifyContent="space-between" spacing="5">