If I understand correctly your question you can just add this CSS in you style.css
file. and add fill-container
to the mat-form field element
.mat-form-field.fill-container,
.mat-form-field.fill-container .mat-form-field-infix,
.mat-form-field.fill-container .mat-form-field-flex,
.mat-form-field.fill-container .mat-form-field-wrapper {
height: 100%;
width: 100%;
}
.mat-form-field.fill-container textarea {
height: calc(100% - 25px);
}
in temlplate
<mat-form-field appearance="fill" class="fill-container">
<mat-label>Textarea</mat-label>
<textarea matInput [matTextareaAutosize]="false"></textarea>
</mat-form-field>
here is the stackblitz example.
https://stackblitz.com/edit/angular-9ms3ph?file=src/app/form-field-overview-example.html
Also if you can use matTextareaAutosize
instead of this style, I recommend usage of this @Input
property
Like this
<div>
<mat-form-field appearance="fill" class="test">
<mat-label>Textarea</mat-label>
<textarea matInput [matTextareaAutosize]="true"></textarea>
</mat-form-field>
</div>