Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a border on a Angular Material textarea field?

I'm using Angular with Material Design components. How can I add a border around a textarea input field using CSS?

Example textarea from https://material.angular.io/components/input/examples:

<form class="example-form">
  <mat-form-field class="example-full-width">
    <textarea matInput placeholder="Leave a comment"></textarea>
  </mat-form-field>
</form>

What the default textarea looks like

like image 433
Trace Bullet Avatar asked Dec 17 '19 20:12

Trace Bullet


People also ask

How do you change the border radius of a mat form field?

You need to increase the min-width of the left outline and apply border radius to only the left or right side.

How do I change the border color on my mat form field?

mat-form-field-outline class . This class is responsible for the 4 sides of borders around the mat form field element. So, to change the mat form field border color, you have to simply override the existing border color with the new one. And to do that we take the help of the ::ng-deep .

What is mat in angular?

The <mat-form-field> is a component that is used to wrap multiple MAT components and implement common text field styles of the form-field such as hint message, underlines, and floating label. These five MAT components are designed to work inside the form-field: <mat-chip-list>

What is field in angular?

<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

if you add appearance="outline" to your mat-form-field it will add a border around your field

source: https://material.angular.io/components/form-field/overview

like image 116
philr Avatar answered Oct 05 '22 10:10

philr