TextBox
Description
The TextBox component enables users to input text data in your application. It is designed for use in forms or any area where textual input is required. As part of the Components group, it provides a simple and uniform way to collect string inputs, with additional customization options for placeholders, read-only modes, password inputs, and styling.
Usage
To use the TextBox component, import the Tesserae UI library and instantiate it using the static helper method. The following sample demonstrates how to create basic TextBox instances including a standard, disabled, read-only, password, and required state.
API reference
public class TextBox : Input<TextBox>, ITextFormating, IHasBackgroundColor, IHasForegroundColor, IRoundedStyleA single-line text input component.
Constructors
Properties
public string Placeholder { get ; set ; }Gets or sets the placeholder text.
public bool IsReadOnly { get ; set ; }Gets or sets whether the text box is read-only.
public int MaxLength { get ; set ; }Gets or sets the maximum length of the text.
public bool IsPassword { get ; set ; }Gets or sets whether the text box is in password mode.
public string Background { get ; set ; }Gets or sets the background color.
Methods
public TextBox SetPlaceholder(string placeholder)Sets the placeholder text.
Parameters
- placeholder
- The placeholder text.
Returns
The current instance.
Samples
Basic and Customized TextBox Examples
The following sample demonstrates creating multiple TextBox variations including standard, disabled, read-only, password input, required state, error messaging, placeholder text, and validation options.