NUI / Components / Common

Button

ImplementedCommon / Input

Button renders an interactive command button that can be wired to behavior through the Event Graph.

Supported as a text-command button.

Overview

Button renders an interactive command button that can be wired to behavior through the Event Graph.

When to use

  • Primary actions.
  • Menu actions.
  • Confirmations.
  • Navigation commands.
  • Other click-driven behavior.

Children

Does not support children.

Basic syntax

nui
Button ConfirmButton {
    text: "Confirm"
    command: "ConfirmSelection"
}

Supported properties

PropertyTypeRequiredDefaultDescription
textstringYesEmptyButton label.
commandstringYesEmptyEvent Graph command name.
enabledboolNotrueWhether the button can be used.
focusableboolNotrueWhether the button can receive focus.
fontstringNoProject defaultLabel font name.
fontSizenumberNo14Label text size.
textColorcolorNoDefaultLabel color.
backgroundColorcolorNoDefaultNormal background color.
hoveredColorcolorNoDefaultHover background color.
pressedColorcolorNoDefaultPressed background color.
disabledColorcolorNoDefaultDisabled background color.
borderColorcolorNoDefaultBorder color.
borderThicknessnumberNo0Border thickness.
radiusnumberNo0Corner radius.
paddingmarginNoDefaultInner label padding.
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
horizontalAlignenumNoInheritedComponent horizontal alignment.
verticalAlignenumNoInheritedComponent vertical alignment.
opacitynumberNo1Render opacity.
layerintegerNoContext defaultLayer order inside layered parents.
visibleboolNotrueVisibility flag.

Contextual properties

Contextual property rules

Button 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
Button ConfirmButton {
    text: "Confirm"
    command: "ConfirmSelection"
    enabled: true
    focusable: true
    font: "ButtonFont"
    fontSize: 16
    textColor: "#FFFFFF"
    backgroundColor: "#275DAD"
    hoveredColor: "#3976CF"
    pressedColor: "#1D467F"
    disabledColor: "#505866"
    borderColor: "#78A8E8"
    borderThickness: 1
    radius: 4
    padding: margin(8, 14, 8, 14)
    width: 160
    height: 40
    horizontalAlign: center
    verticalAlign: center
    opacity: 1
    layer: 1
    visible: true
}

Limitations

  • Button does not currently support manually authored child content.
  • Use command, not the legacy action alias, in public documentation.