NUI / Components / Layout
Panel
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.
children {
Text ChildText {
text: "THIS IS THE CHILD COMPONENT"
}
}Basic syntax
Panel InfoPanel {
children {
Text ChildText {
text: "THIS IS THE CHILD COMPONENT"
}
}
}Supported properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
width | number | No | Auto | Desired width. |
height | number | No | Auto | Desired height. |
padding | margin | No | margin(0) | Inner padding. |
childPadding | margin | No | margin(0) | Padding around children. |
backgroundColor | color | No | Transparent | Optional background color. |
horizontalAlign | enum | No | Inherited | Component horizontal alignment. |
verticalAlign | enum | No | Inherited | Component vertical alignment. |
contentHorizontalAlign | enum | No | Inherited | Child horizontal alignment. |
contentVerticalAlign | enum | No | Inherited | Child vertical alignment. |
opacity | number | No | 1 | Render opacity. |
layer | integer | No | Context default | Layer order inside layered parents. |
visible | bool | No | true | Visibility 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
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.