NUI / Components / Input

TextInput

ImplementedInput

TextInput renders a styled single-line text input.

Supported as a styled text input field.

Overview

TextInput renders a styled single-line text input.

When to use

  • Forms.
  • Settings.
  • Search fields.
  • Names.
  • Other styled single-line input.

Children

Does not support children.

Basic syntax

nui
TextInput SearchField {
    placeholder: "Search"
}

Supported properties

PropertyTypeRequiredDefaultDescription
textstringNoEmptyInitial text value.
placeholderstringNoEmptyPlaceholder text.
enabledboolNotrueWhether the input can be used.
focusableboolNotrueWhether the input can receive focus.
fontstringNoProject defaultField font name.
fontSizenumberNo14Text size.
textColorcolorNoDefaultText color.
placeholderColorcolorNoDefaultPlaceholder color.
selectionColorcolorNoDefaultSelection highlight color.
caretColorcolorNoDefaultCaret color.
backgroundColorcolorNoDefaultField background.
hoveredColorcolorNoDefaultHover background.
disabledColorcolorNoDefaultDisabled background.
borderColorcolorNoDefaultBorder color.
borderThicknessnumberNo0Border thickness.
radiusnumberNo0Corner radius.
textAlignenumNoleftHorizontal text alignment.
verticalTextAlignenumNocenterVertical text alignment.
paddingmarginNoDefaultText padding.
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
opacitynumberNo1Render opacity.
visibleboolNotrueVisibility flag.

Contextual properties

Contextual property rules

TextInput 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
TextInput SearchField {
    text: ""
    placeholder: "Search"
    enabled: true
    focusable: true
    font: "BodyFont"
    fontSize: 16
    textColor: "#F8FAFC"
    placeholderColor: "#94A3B8"
    selectionColor: "#2563EB"
    caretColor: "#FFFFFF"
    backgroundColor: "#111827"
    hoveredColor: "#1F2937"
    disabledColor: "#4B5563"
    borderColor: "#334155"
    borderThickness: 1
    radius: 4
    textAlign: left
    verticalTextAlign: center
    padding: margin(6, 8, 6, 8)
    width: 280
    height: 36
    opacity: 1
    visible: true
}

Limitations

  • Current public docs should treat this as a single-line input.
  • Multiline input and rich text input are planned separately.