Skip to content
Version 2.32.0
↓ Get the launcher

InputElement record

Single-line text field (wraps the proven UGuiTextInput: Enter submits without opening chat, Esc/cursor escape). Get seeds the text; Enter/blur calls Submit. OnChange (optional) fires per-keystroke — use it for live filters that should reflow as-you-type rather than on Enter.

public record InputElement : IEquatable<HudElement>
name description
InputElement(…) Single-line text field (wraps the proven UGuiTextInput: Enter submits without opening chat, Esc/cursor escape). Get seeds the text; Enter/blur calls Submit. OnChange (optional) fires per-keystroke — use it for live filters that should reflow as-you-type rather than on Enter.
AutoFocus { get; set; } Opt-in: when the window hosting this field is OPENED/toggled visible by the user, the framework gives this field keyboard focus (uGUI ActivateInputField) so the user can type immediately without clicking it first. Focus fires on the user-initiated show transition (hotkey toggle, SetVisible(true), close-button reopen) — NOT on a ShouldRender re-mount (e.g. zoning back into the world with the window already toggled on), so chat never steals movement keys on a world load. Only fires when the field’s GameObject is active in the hierarchy (a field inside a collapsed ConditionalElement is skipped). If more than one field in a window sets it, the first one built wins. Default false = unchanged. Added as an init property (NOT a ctor param) so the record stays source + binary compatible with already-compiled plugins.
FocusRequest { get; set; } Opt-in: focus this field ON DEMAND, at any time (not just on window open like AutoFocus). The framework polls the returned number; whenever it CHANGES (the first value observed when the window is built never counts), the field takes keyboard focus the same way a click on it would, with the caret at the END of the text and nothing selected — so the user can keep typing. Typical use: an emoji/insert picker whose click would otherwise leave the field unfocused — keep an int, increment it in the click handler, and bind FocusRequest = () => _seq. While focused the game’s keyboard is suppressed as for any focused field; Esc/click-away release it. A request on a field that isn’t visible (collapsed ConditionalElement, hidden window) is dropped after a short wait rather than firing later. Default null = unchanged. Init property (NOT a ctor param) for binary compatibility.
Get { get; set; }
InsertRequest { get; set; } Opt-in: insert text AT THE CARET on demand (an emoji/insert picker). The framework polls the returned pair; whenever Seq CHANGES (the first value observed when the window is built never counts), Text is inserted where the caret was when the field last had focus — replacing the selection if there was one, and never inside a RichEmoji<sprite=N> tag — then the field takes focus with the caret right AFTER the inserted text. No known caret (never focused, or the text was replaced from Get since) = append at the end. OnChange then reports the new text, exactly like a typed edit, so the bound value follows; no separate FocusRequest is needed. Default null = unchanged. Init property (NOT a ctor param) for binary compatibility.
Locked { get; set; } Opt-in live lock: while the returned value is true the field is READ-ONLY (typing, paste, cut, delete and Enter-submit are blocked; focus, caret and selection still work, and Get still re-seeds the text) and its text is drawn DIMMED, as a “busy, please wait” state — e.g. a chat composer while its draft is being translated. Polled with the window refresh and diffed (only a change writes anything); the box keeps its size. Both the plain and the RichEmoji field. Default null = never locked, unchanged. Init property (NOT a ctor param) for binary compatibility.
OnChange { get; set; }
Placeholder { get; set; } Opt-in hint text shown dimmed inside the field while it is EMPTY (e.g. “Message Guild…”), in both the plain and the RichEmoji field. Polled with the window refresh and diffed, so it can follow live state; return a cached string (it is read every refresh). Default null = no hint, unchanged. Init property (NOT a ctor param) for binary compatibility.
RichEmoji { get; set; } Opt-in: draw inline chat emoji tags (<sprite=N>, N = 1..63) in the field as the game’s emoji PICTURES — like the game’s own chat input box — instead of the literal tag text. The tag stays in the text unchanged (Get / OnChange / Submit all see <sprite=N>), the caret steps over a picture as one character, and one Backspace/Delete removes the whole tag. When Get changes externally (e.g. a picker appended a tag) the field shows it and the caret moves to the END. Other behaviour (Enter submit without opening chat, Esc, keyboard gate, SingleLine, AutoFocus) is the same; one difference: focusing does NOT select all, so a click places the caret instead of arming a replace-everything. Same per-string font limitation as RichEmoji (one face per string: mixed Thai + CJK shows boxes for one script). Window surfaces only; falls back to the plain field when the rich field can’t be built. Default false = unchanged. Init property (NOT a ctor param) for binary compatibility.
SingleLine { get; set; } Opt-in: render on a single visible line that never grows vertically. Long/pasted text overflows (scrolls) HORIZONTALLY within a fixed-height box instead of wrapping to more lines and growing the field — which, in an auto-height window, grows the whole window. Pasted newlines are stripped (the text stays one line). Unlike the default mode, Enter submits AND ends editing (the field drops focus; click it to type again) — the game’s chat still never opens. Default false keeps the existing behaviour (the field wraps and grows), so every current InputElement is byte-for-byte unchanged. Added as an init property (NOT a primary-ctor param) so the record constructor stays source AND binary compatible with already-compiled plugins — see PerPluginServices-Decoration.md §3 / WindowBuilder-Patterns.md “Binary compatibility rules”.
Submit { get; set; }
Width { get; set; }