Flexbox docs

This commit is contained in:
Sabine Lim
2023-05-08 07:00:28 +10:00
parent e2bead28cb
commit c9ff68dd9e
5 changed files with 110 additions and 6 deletions

View File

@@ -0,0 +1,19 @@
## getSpacing
### Description
Returns the space between objects
### Returns
1. `number` Number of pixels of spacing between each object
### Usage
* Creates a default flexbox and prints the default spacing.
```lua
local main = basalt.createFrame()
local flexbox = mainFrame:addFlexbox()
basalt.debug(flexbox:getSpacing())
```

View File

@@ -0,0 +1,23 @@
## setFlexDirection
### Description
Sets the direction in which the children will be placed
### Parameters
1. `string` One of ("row", "column") - default is row
### Returns
1. `object` The object in use
### Usage
* Creates a default flexbox and sets the flex direction to column.
```lua
local main = basalt.createFrame()
local flexbox = mainFrame:addFlexbox()
:setFlexDirection("column")
```

View File

@@ -0,0 +1,23 @@
## setJustifyContent
### Description
Determines how the children are aligned along the main axis
### Parameters
1. `string` One of ("flex-start", "flex-end", "center", "space-between", "space-around") - default is flex-start. Works the same as the property of the same name in [CSS flexboxes](https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-flexbox-properties)
### Returns
1. `object` The object in use
### Usage
* Creates a default flexbox and sets the justify content to space-between.
```lua
local main = basalt.createFrame()
local flexbox = mainFrame:addFlexbox()
:setJustifyContent("space-between")
```

View File

@@ -0,0 +1,23 @@
## setSpacing
### Description
Sets the space between objects
### Parameters
1. `number` Number of pixels of spacing between each object - default is 1
### Returns
1. `object` The object in use
### Usage
* Creates a default flexbox and sets the spacing to 5 pixels.
```lua
local main = basalt.createFrame()
local flexbox = mainFrame:addFlexbox()
:setSpacing(5)
```