TextArea
Description
A control to input multiple lines of text
TextAreas allow users to enter and edit multi-line text. They are commonly used for comments, descriptions, or any input that requires multiple lines of text.
API reference
public sealed class TextArea : ComponentBase<TextArea, HTMLTextAreaElement>, ICanValidate<TextArea>, IObservableComponent<string>, ITabIndex, IRoundedStyleA multi-line text input component.
Constructors
Properties
public bool IsEnabled { get ; set ; }Gets or sets whether the component is enabled.
public bool IsReadOnly { get ; set ; }Gets or sets whether the component is read-only.
public string Placeholder { get ; set ; }Gets or sets the placeholder text.
public int MaxLength { get ; set ; }Gets or sets the maximum length of the text.
public bool IsInvalid { get ; set ; }Gets or sets whether the component is in an invalid state.
Methods
public override HTMLElement Render()Renders the component.
Returns
The rendered HTML element.
public void Attach(ComponentEventHandler<TextArea> handler)Attaches a handler to the input updated event.
Parameters
- handler
- The handler.
public TextArea SetText(string text)Sets the text of the text area.
Parameters
- text
- The text.
Returns
The current instance.
public TextArea SetPlaceholder(string placeholder)Sets the placeholder text.
Parameters
- placeholder
- The placeholder text.
Returns
The current instance.
public TextArea Disabled(bool value = true)Sets whether the component is disabled.
Parameters
- value
- Whether it's disabled.
Returns
The current instance.
public IObservable<string> AsObservable()Returns an observable of the text.
public TextArea AutoResize(bool allowShrink = true, int? minHeight = null, int? maxHeight = null)Enables auto-resizing of the text area as the user types, based on the scrollHeight.
Parameters
- allowShrink
- If false, the text area will not shrink below its initial size.
- minHeight
- If set, specifies a minimum pixel height for the text area.
- maxHeight
- If set, specifies a maximum pixel height for the text area. Content will scroll if it exceeds this height.
Returns
The current instance.