ion-textarea
The textarea component is used for multi-line text input. A native textarea element is rendered inside of the component. The user experience and interactivity of the textarea component is improved by having control over the native textarea.
Unlike the native textarea element, the Ionic textarea does not support loading its value from the inner content. The textarea value should be set in the value
attribute.
The textarea component accepts the native textarea attributes in addition to the Ionic properties.
Basic Usage
Autogrow
When the autoGrow
property is set to true
, the textarea will grow and shrink based on its contents.
Clear on Edit
Setting the clearOnEdit
property to true
will clear the textarea after it has been blurred and then typed in again.
Theming
Interfaces
TextareaChangeEventDetail
interface TextareaChangeEventDetail {
value?: string | null;
}
TextareaCustomEvent
While not required, this interface can be used in place of the CustomEvent
interface for stronger typing with Ionic events emitted from this component.
interface TextareaCustomEvent extends CustomEvent {
detail: TextareaChangeEventDetail;
target: HTMLIonTextareaElement;
}