Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Angular Material have built in autosizing for textareas?

I am able to import MatTextareaAutosize from Angular Material, but I see nothing about it in the docs and have not found a way to use it.

I expected to use something like this:

<mat-form-field>
    <textarea matInput matAutosize></textarea>
</mat-form-field>

Is there a way to get autosizing text boxes with angular material?

like image 407
Dave Molinero Avatar asked Oct 24 '17 00:10

Dave Molinero


People also ask

What is mat in angular material?

<mat-form-field> is a component used to wrap several Angular Material components and apply common Text field styles such as the underline, floating label, and hint messages.


1 Answers

For my work apply this to textarea:

Angular 7

<textarea cdkTextareaAutosize #autosize="cdkTextareaAutosize"cdkAutosizeMinRows="1" cdkAutosizeMaxRows="5"> </textarea>

Verify the scroll, in case of not showing verify the CSS property 'overflow: auto'

like image 69
Gedward Romo Avatar answered Oct 25 '22 09:10

Gedward Romo