Class TextField
Text Field UI element.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class TextField : ExVisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, IInputElement<string>, IValidatableElement<string>, INotifyValueChanging<string>, INotifyValueChanged<string>
Constructors
TextField()
Default constructor.
Declaration
public TextField()
TextField(string)
Construct a TextField with a predefined text value.
Declaration
public TextField(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
inputContainerUssClassName
The TextField input container styling class.
Declaration
public const string inputContainerUssClassName = "appui-textfield__inputcontainer"
Field Value
Type | Description |
---|---|
string |
inputUssClassName
The TextField input styling class.
Declaration
public const string inputUssClassName = "appui-textfield__input"
Field Value
Type | Description |
---|---|
string |
leadingContainerUssClassName
The TextField leading container styling class.
Declaration
public const string leadingContainerUssClassName = "appui-textfield__leadingcontainer"
Field Value
Type | Description |
---|---|
string |
leadingIconUssClassName
The TextField leading icon styling class.
Declaration
public const string leadingIconUssClassName = "appui-textfield__leadingicon"
Field Value
Type | Description |
---|---|
string |
placeholderUssClassName
The TextField placeholder styling class.
Declaration
public const string placeholderUssClassName = "appui-textfield__placeholder"
Field Value
Type | Description |
---|---|
string |
sizeUssClassName
The TextField size styling class.
Declaration
public const string sizeUssClassName = "appui-textfield--size-"
Field Value
Type | Description |
---|---|
string |
trailingContainerUssClassName
The TextField trailing container styling class.
Declaration
public const string trailingContainerUssClassName = "appui-textfield__trailingcontainer"
Field Value
Type | Description |
---|---|
string |
trailingIconUssClassName
The TextField trailing icon styling class.
Declaration
public const string trailingIconUssClassName = "appui-textfield__trailingicon"
Field Value
Type | Description |
---|---|
string |
ussClassName
The TextField main styling class.
Declaration
public const string ussClassName = "appui-textfield"
Field Value
Type | Description |
---|---|
string |
Properties
contentContainer
The content container of the TextField.
Declaration
public override VisualElement contentContainer { get; }
Property Value
Type | Description |
---|---|
VisualElement |
Overrides
invalid
The invalid state of the TextField.
Declaration
public bool invalid { get; set; }
Property Value
Type | Description |
---|---|
bool |
isPassword
Whether the TextField is a password field.
Declaration
public bool isPassword { get; set; }
Property Value
Type | Description |
---|---|
bool |
isReadOnly
Whether the TextField is read-only.
Declaration
public bool isReadOnly { get; set; }
Property Value
Type | Description |
---|---|
bool |
leadingElement
The TextField leading element.
Declaration
public VisualElement leadingElement { get; set; }
Property Value
Type | Description |
---|---|
VisualElement |
leadingIconName
The leading icon name.
Declaration
public string leadingIconName { get; set; }
Property Value
Type | Description |
---|---|
string |
maskChar
The TextField mask character.
Declaration
public char maskChar { get; set; }
Property Value
Type | Description |
---|---|
char |
maxLength
The TextField max length.
Declaration
public int maxLength { get; set; }
Property Value
Type | Description |
---|---|
int |
placeholder
The TextField placeholder text.
Declaration
public string placeholder { get; set; }
Property Value
Type | Description |
---|---|
string |
size
The TextField size.
Declaration
public Size size { get; set; }
Property Value
Type | Description |
---|---|
Size |
trailingElement
The TextField trailing element.
Declaration
public VisualElement trailingElement { get; set; }
Property Value
Type | Description |
---|---|
VisualElement |
trailingIconName
The trailing icon name.
Declaration
public string trailingIconName { get; set; }
Property Value
Type | Description |
---|---|
string |
validateValue
The validation function for the TextField.
Declaration
public Func<string, bool> validateValue { get; set; }
Property Value
Type | Description |
---|---|
Func<string, bool> |
value
The TextField value.
Declaration
public string value { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
GetSizeUssClassName(Size)
Declaration
public static string GetSizeUssClassName(Size enumValue)
Parameters
Type | Name | Description |
---|---|---|
Size | enumValue |
Returns
Type | Description |
---|---|
string |
SetValueWithoutNotify(string)
Set the TextField value without notifying the change.
Declaration
public void SetValueWithoutNotify(string newValue)
Parameters
Type | Name | Description |
---|---|---|
string | newValue | The new value of the TextField. |