UI Layout
Updated
Flexbox container that arranges child UI elements.
- Type
comp-ui-layout- Script class
UILayoutComponent- Per entity
- One
- Version
- 1.4.0
Read about it in Panels and layout: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
flexGrow |
0 ≤ x ≤ 1000 |
|
gap |
0 ≤ x ≤ 16384 |
|
height |
0 ≤ x ≤ 16384 |
|
margin |
||
margin[] |
- |
|
maxHeight |
0 ≤ x ≤ 16384 |
|
maxWidth |
0 ≤ x ≤ 16384 |
|
minHeight |
0 ≤ x ≤ 16384 |
|
minWidth |
0 ≤ x ≤ 16384 |
|
padding |
||
padding[] |
0 ≤ x ≤ 16384 |
|
pixelSize |
0. |
|
position |
- |
|
positionLeft |
- |
|
positionRight |
- |
|
positionTop |
- |
|
stackOrder |
- |
|
width |
0 ≤ x ≤ 16384 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A toolbar row with a spacerA script fills a row panel with a title, a UI Spacer and two buttons, so the title sits on the left and the buttons on the right; Close hides the toolbar.
Press Share to log a message, and Close to hide the toolbar. Drag outside the panel to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(UILayoutComponent); if (component) log(component.props);}