NUI / Components / Common

ColorBlock

ImplementedCommon / Display

ColorBlock renders a plain color-filled block.

Supported as a simple filled color block.

Overview

ColorBlock renders a plain color-filled block.

When to use

  • Swatches.
  • Background fills.
  • Placeholders.
  • Simple color indicators.

Children

Does not support children.

Basic syntax

nui
ColorBlock Swatch {
    color: "#2EC4B6"
    width: 24
    height: 24
}

Supported properties

PropertyTypeRequiredDefaultDescription
colorcolorNoDefaultFill color.
backgroundColorcolorNoDefaultFill color alias used by visual components.
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
minWidthnumberNoUnsetMinimum width.
minHeightnumberNoUnsetMinimum height.
maxWidthnumberNoUnsetMaximum width.
maxHeightnumberNoUnsetMaximum height.
opacitynumberNo1Render opacity.
layerintegerNoContext defaultLayer order inside layered parents.
visibleboolNotrueVisibility flag.

Contextual properties

Contextual property rules

ColorBlock 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
ColorBlock Swatch {
    color: "#2EC4B6"
    width: 24
    height: 24
    minWidth: 12
    minHeight: 12
    maxWidth: 48
    maxHeight: 48
    opacity: 1
    layer: 1
    visible: true
}

Limitations

  • ColorBlock does not expose border or corner styling as normal public syntax. Use Rectangle for styled visual primitives.