NUI / Components / Layout

WrapBox

ImplementedLayout

WrapBox lays out children in sequence and wraps to a new line when needed.

Supported as a wrapping flow layout.

Overview

WrapBox lays out children in sequence and wraps to a new line when needed.

When to use

  • Chips.
  • Tag lists.
  • Responsive icon rows.
  • Compact action groups.
  • Wrapping inventory-like displays.

Children

Supports normal children.

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

Basic syntax

nui
WrapBox Tags {
    gap: 6

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

Supported properties

PropertyTypeRequiredDefaultDescription
orientationenumNohorizontalWrap direction.
wrapSizenumberNoUnsetSize threshold before wrapping.
gapnumberNo0Space between children.
innerPaddingmarginNomargin(0)Padding between wrapped entries.
lineAlignmentenumNoDefaultAlignment of wrapped lines.
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
paddingmarginNomargin(0)Inner padding.
backgroundColorcolorNoTransparentOptional background color.
opacitynumberNo1Render opacity.
layerintegerNoContext defaultLayer order inside layered parents.
visibleboolNotrueVisibility flag.

Contextual properties

Contextual property rules

Children of WrapBox may use wrap slot properties. WrapBox itself may receive stack, canvas, grid, or ExpandableArea slot properties only when it is a child of the matching parent. See section 7.

Full syntax example

nui
WrapBox Tags {
    orientation: horizontal
    wrapSize: 320
    gap: 6
    innerPadding: margin(4)
    lineAlignment: left
    width: 360
    height: 160
    padding: margin(8)
    backgroundColor: "#0F172A"
    opacity: 1
    layer: 1
    visible: true

    children {
        Text ChildText {
            text: "THIS IS THE CHILD COMPONENT"
            fillEmptySpace: false
            fillSpanWhenLessThan: 0
            forceNewLine: false
        }
    }
}

Limitations

  • Wrap slot properties are valid only on direct children of WrapBox.