NUI / Components / Layout

Panel

ImplementedLayout

Panel is a general-purpose container for grouping child components.

Supported as a general child container.

Overview

Panel is a general-purpose container for grouping child components.

When to use

  • Use Panel when you need a neutral container and do not need row, column, canvas, grid, wrap, or overlay-specific behavior.

Children

Supports normal children.

nui
children {
    Text ChildText {
        text: "THIS IS THE CHILD COMPONENT"
    }
}

Basic syntax

nui
Panel InfoPanel {
    children {
        Text ChildText {
            text: "THIS IS THE CHILD COMPONENT"
        }
    }
}

Supported properties

PropertyTypeRequiredDefaultDescription
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
paddingmarginNomargin(0)Inner padding.
childPaddingmarginNomargin(0)Padding around children.
backgroundColorcolorNoTransparentOptional background color.
horizontalAlignenumNoInheritedComponent horizontal alignment.
verticalAlignenumNoInheritedComponent vertical alignment.
contentHorizontalAlignenumNoInheritedChild horizontal alignment.
contentVerticalAlignenumNoInheritedChild vertical alignment.
opacitynumberNo1Render opacity.
layerintegerNoContext defaultLayer order inside layered parents.
visibleboolNotrueVisibility flag.

Contextual properties

Contextual property rules

Panel may receive stack, canvas, grid, wrap, or ExpandableArea slot properties only when it is authored as a direct child of the matching parent. See section 7.

Full syntax example

nui
Panel InfoPanel {
    width: 300
    height: 160
    padding: margin(12)
    childPadding: margin(4)
    backgroundColor: "#111827"
    horizontalAlign: fill
    verticalAlign: top
    contentHorizontalAlign: left
    contentVerticalAlign: top
    opacity: 1
    layer: 1
    visible: true

    children {
        Text ChildText {
            text: "THIS IS THE CHILD COMPONENT"
        }
    }
}

Limitations

  • Use more specific layout containers when ordering, wrapping, absolute positioning, or grid placement is required.