NUI / Components / Common

Border

ImplementedCommon / Display

Border draws a background, border, and corner radius around child content.

Supported as a visual frame container.

Overview

Border draws a background, border, and corner radius around child content.

When to use

  • Framed content.
  • Panels with visible edges.
  • Item backgrounds.
  • Visual grouping.

Children

Supports normal children.

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

Basic syntax

nui
Border CardBorder {
    backgroundColor: "#111827"

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

Supported properties

PropertyTypeRequiredDefaultDescription
backgroundColorcolorNoTransparentFill color behind children.
borderColorcolorNoTransparentBorder color.
borderThicknessnumberNo0Border thickness.
radiusnumberNo0Corner radius.
paddingmarginNomargin(0)Inner padding around children.
childPaddingmarginNomargin(0)Additional child padding.
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
minWidthnumberNoUnsetMinimum width.
minHeightnumberNoUnsetMinimum height.
maxWidthnumberNoUnsetMaximum width.
maxHeightnumberNoUnsetMaximum height.
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

Border 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
Border CardBorder {
    backgroundColor: "#111827"
    borderColor: "#334155"
    borderThickness: 1
    radius: 6
    padding: margin(12)
    childPadding: margin(4)
    width: 280
    height: 120
    minWidth: 180
    minHeight: 80
    maxWidth: 420
    maxHeight: 240
    horizontalAlign: fill
    verticalAlign: top
    contentHorizontalAlign: left
    contentVerticalAlign: center
    opacity: 1
    layer: 1
    visible: true

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

Limitations

  • Use Border for visual frames. Use Box or SizeBox when the main purpose is layout sizing.