NUI / Components / Common

Icon

ImplementedCommon / Media

Icon displays a compact icon resource.

Supported for registered icon resources.

Overview

Icon displays a compact icon resource.

When to use

  • Compact status symbols.
  • Toolbar affordances.
  • Resource indicators.
  • Command markers.

Children

Does not support children.

Basic syntax

nui
Icon AlertIcon {
    resource: WarningIcon
}

Supported properties

PropertyTypeRequiredDefaultDescription
resourceresourceYesNoneIcon resource slot.
tintColorcolorNoWhiteTint applied to the icon.
fitenumNostretchIcon fit mode.
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
opacitynumberNo1Render opacity.
layerintegerNoContext defaultLayer order inside layered parents.
visibleboolNotrueVisibility flag.

Contextual properties

Contextual property rules

Icon 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
Icon AlertIcon {
    resource: WarningIcon
    tintColor: "#FFD166"
    fit: contain
    width: 24
    height: 24
    opacity: 1
    layer: 1
    visible: true
}

Limitations

  • resource must refer to a valid project icon resource.