Skip to content

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.

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[] -16384 ≤ x ≤ 16384
maxHeight 0 ≤ x ≤ 16384
maxWidth 0 ≤ x ≤ 16384
minHeight 0 ≤ x ≤ 16384
minWidth 0 ≤ x ≤ 16384
padding
padding[] 0 ≤ x ≤ 16384
pixelSize 0.000001 ≤ x ≤ 1
positionBottom -16384 ≤ x ≤ 16384
positionLeft -16384 ≤ x ≤ 16384
positionRight -16384 ≤ x ≤ 16384
positionTop -16384 ≤ x ≤ 16384
stackOrder -32768 ≤ x ≤ 32767
width 0 ≤ x ≤ 16384

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(UILayoutComponent);
if (component) log(component.props);
}