InputTextareaInputtextarea add styling and autoResize functionality to standard textare element.

InputTextArea - 图1

Documentation

Import

  1. import {InputTextareaModule} from 'primeng/inputtextarea';
  2.  

Getting Started

InputTextarea is applied to an input field with pInputTextarea directive.

  1. <textarea pInputTextarea></textarea>
  2.  

Model Binding

A model can be bound using the standard ngModel directive.

  1. <textarea pInputTextarea [(ngModel)]="property"></textarea>
  2.  

AutoResize

In auto resize mode, textarea grows instead of displaying a scrollbar. When this feature is enabled, rows and cols properties are required to be defined.

  1. <textarea [rows]="5" [cols]="30" pInputTextarea autoResize="autoResize"></textarea>
  2.  

Properties

NameTypeDefaultDescription
autoResizebooleanfalseWhen present, textarea size changes as being typed.
disabledbooleanfalseWhen present, it specifies that the element should be disabled.

Events

NameParametersDescription
onResizeevent: Event objectCallback to invoke when element is resized.

Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
ui-inputtextareaTextarea element

Dependencies

None.

Source

View on GitHub

  1. <h3 class="first">Default</h3>
  2. <textarea rows="5" cols="30" pInputTextarea></textarea>
  3. <h3>AutoResize</h3>
  4. <textarea rows="5" cols="30" pInputTextarea autoResize="autoResize"></textarea>
  5.