Skip to content

UITextArea Class

Definition

Namespace: Brine2D.UI

Multiline text area with cursor, selection, scrolling, clipboard, and undo/redo. Use UITextInput for single-line input.

C#
public class UITextArea : Brine2D.UI.IUIComponent, Brine2D.UI.IAnchoredUIComponent

Inheritance System.Object → UITextArea

Implements IUIComponent, IAnchoredUIComponent

Properties
Anchor The screen anchor point this component is positioned relative to.
AnchorOffset Pixel offset from the resolved anchor point.
CharacterFilter Optional per-character filter. When set, only characters for which the delegate returns true are accepted — both from direct typing and from paste. Leave null to accept all characters.
CursorPosition Current cursor position \(character index into [Text](Text.md 'Brine2D\.UI\.UITextArea\.Text'), 0 = before first character\).
Font Font to use for rendering \(null = renderer default\).
IsFocused Whether this text area is currently focused.
LineHeight Line height in pixels. Defaults to 20. Set this to match the cap-height of a custom Font.
MaxLength Maximum character length \(0 = unlimited\).
Placeholder Placeholder text shown when empty and unfocused.
ReadOnly When true, the field displays its text but rejects all edits. Navigation and copy \(Ctrl\+C\) still work.
TabInsertsTab When true, pressing Tab inserts '\t' instead of advancing focus. Defaults to false.
Text Current text value. Lines are separated by '\n'.
UndoStackLimit Maximum number of undo steps retained. Defaults to 100.
Methods
InsertTab() Inserts a tab character \('\\t'\) at the current cursor position. Called by UICanvas when TabInsertsTab is true and Tab is pressed. No-op when ReadOnly is true.
Events
OnFocusGained Event fired when this text area gains keyboard focus.
OnFocusLost Event fired when this text area loses keyboard focus.
OnTextChanged Event fired when text changes.