Class TextArea
Text Area UI element.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class TextArea : ExVisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, IInputElement<string>, IValidatableElement<string>, INotifyValueChanging<string>, INotifyValueChanged<string>
Constructors
TextArea()
Default constructor.
Declaration
public TextArea()
TextArea(string)
Construct a TextArea with a predefined text value.
Declaration
public TextArea(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | A default text value. |
Remarks
No event will be triggered when setting the text value during construction.
Fields
inputUssClassName
The TextArea input styling class.
Declaration
public const string inputUssClassName = "appui-textarea__input"
Field Value
Type | Description |
---|---|
string |
placeholderUssClassName
The TextArea placeholder styling class.
Declaration
public const string placeholderUssClassName = "appui-textarea__placeholder"
Field Value
Type | Description |
---|---|
string |
resizeHandleUssClassName
The TextArea resize handle styling class.
Declaration
public const string resizeHandleUssClassName = "appui-textarea__resize-handle"
Field Value
Type | Description |
---|---|
string |
scrollViewUssClassName
The TextArea input container styling class.
Declaration
public const string scrollViewUssClassName = "appui-textarea__scrollview"
Field Value
Type | Description |
---|---|
string |
ussClassName
The TextArea main styling class.
Declaration
public const string ussClassName = "appui-textarea"
Field Value
Type | Description |
---|---|
string |
Properties
autoResize
Automatically resize the TextArea if the content is larger than the current size.
Declaration
public bool autoResize { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This will only grow the TextArea. It will not shrink it.
If the user manually resizes the TextArea, the auto resize will be disabled.
autoShrink
Whether the TextArea should automatically shrink if the content is smaller than the current size.
Declaration
public bool autoShrink { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
To enable this feature, autoResize must be set to true.
contentContainer
The content container of the TextArea.
Declaration
public override VisualElement contentContainer { get; }
Property Value
Type | Description |
---|---|
VisualElement |
Overrides
invalid
The invalid state of the TextArea.
Declaration
public bool invalid { get; set; }
Property Value
Type | Description |
---|---|
bool |
isReadOnly
Whether the TextArea is read-only.
Declaration
public bool isReadOnly { get; set; }
Property Value
Type | Description |
---|---|
bool |
maxLength
The maximum length of the TextArea.
Declaration
public int maxLength { get; set; }
Property Value
Type | Description |
---|---|
int |
placeholder
The TextArea placeholder text.
Declaration
public string placeholder { get; set; }
Property Value
Type | Description |
---|---|
string |
submitModifiers
The modifiers required to submit the TextArea.
Declaration
public EventModifiers submitModifiers { get; set; }
Property Value
Type | Description |
---|---|
EventModifiers |
submitOnEnter
Whether the TextArea should invoke the submitted event when the user presses the Enter key.
Declaration
public bool submitOnEnter { get; set; }
Property Value
Type | Description |
---|---|
bool |
validateValue
The validation function for the TextArea.
Declaration
public Func<string, bool> validateValue { get; set; }
Property Value
Type | Description |
---|---|
Func<string, bool> |
value
The TextArea value.
Declaration
public string value { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
SetValueWithoutNotify(string)
Set the TextArea value without notifying the change.
Declaration
public void SetValueWithoutNotify(string newValue)
Parameters
Type | Name | Description |
---|---|---|
string | newValue | The new value of the TextArea. |
Events
submitted
Event triggered when the user presses the Enter key and submitOnEnter is true.
Declaration
public event Action submitted
Event Type
Type | Description |
---|---|
Action |