This commit is contained in:
NoryiE
2025-04-05 22:57:46 +00:00
parent d10ba0701f
commit 4dd6bbac7f
12 changed files with 146 additions and 16 deletions

View File

@@ -1,6 +1,25 @@
# Flexbox : Container
This is the Flexbox class. It is a container that arranges its children in a flexible layout.
### Usage
```lua
local flex = main:addFlexbox({background=colors.black, width=30, height=10})
flex:addButton():setFlexGrow(1)
flex:addButton():setFlexGrow(1)
flex:addButton():setFlexGrow(1)
```
The flexbox element adds the following properties to its children:
### Usage
```lua
flex:addButton():setFlexGrow(1) -- The flex-grow property defines the ability for a flex item to grow if necessary.
flex:addButton():setFlexShrink(1) -- The flex-shrink property defines the ability for a flex item to shrink if necessary.
flex:addButton():setFlexBasis(1) -- The flex-basis property defines the default size of an element before the remaining space is distributed.
```
## Properties
|Property|Type|Default|Description|
@@ -25,7 +44,7 @@ This is the Flexbox class. It is a container that arranges its children in a fle
|---|---|---|
|Flexbox:init|Flexbox|Initializes the Flexbox instance
|Flexbox:removeChild|Flexbox|Removes a child element from the flexbox
|Flexbox:render|Flexbox|Renders the flexbox and its children
|Flexbox:render|-|Renders the flexbox and its children
## Flexbox:addChild(element)
Adds a child element to the flexbox