A
A
andreys752019-08-22 17:46:20
Angular
andreys75, 2019-08-22 17:46:20

How does cdkTextareaAutosize from Material Angular work?

Good afternoon
, there is someone else's code where there are many textarea elements. they are all formatted like this:

<mat-form-field class="col-md-12">
                <mat-label>Somthing</mat-label>
                <textarea type="text"
                          matInput
                          cdkTextareaAutosize
                          #autosize="cdkTextareaAutosize"
                          cdkAutosizeMinRows="2"
                          cdkAutosizeMaxRows="8"
                          [(ngModel)]="Somthing"
                          name="Somthing"></textarea>
              </mat-form-field>

somehow height 18 px is added by default
<textarea _ngcontent-sig-c15="" cdkautosizemaxrows="8" cdkautosizeminrows="1" cdktextareaautosize="" 
class="cdk-textarea-autosize mat-input-element mat-form-field-autofill-control 
cdk-text-field-autofill-monitored ng-untouched ng-pristine ng-valid" matinput="" rows="1" ng-reflect-model="Somthing " ng-reflect-min-rows="1" ng-reflect-max-rows="8" ng-reflect-enabled="" id="mat-input-35" aria-invalid="false" aria-required="false" placeholder="" 
style="min-height: 18px; max-height: 144px; height: 18px;">
</textarea>

How to change height:18px globally?
Naturally, I can set the desired value in css but for each component separately, but it looks strange!
Thanks in advance for the tip

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sashqa, 2019-08-22
@Sashqa

here is how textareaautosize works

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question