Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the outline mat-form-filed border corner radius

I am using the angular material outline mat-form-field to design a form. I am getting the default mat-form-field outline text-box view with a border corner radius. Is there any way to remove the border corner radius of the outline mat-form-field and convert into a square text box view.

I tried to change the default styles of the angular material mat-form-field with the following, but it's not working.

//css

.mat-form-field-appearance-outline .mat-form-field-outline-start 
.alignment{
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
}

//html

<mat-form-field appearance="outline" [hideRequiredMarker]="true" 
class="alignment">
<mat-label>Email Address</mat-label>
<input type="text" matInput placeholder="Enter email address">
</mat-form-field>

I expect the outline mat-form-field with no border corner radius text box just like a square text box mat-form-field, but getting the default outline mat-form-field view.

like image 694
Anup Avatar asked Dec 23 '18 21:12

Anup


People also ask

How do you remove a mat Border Field?

Try border-style: none . – N.F.

How do you remove a space Bottom mat form field?

Turn off encapsulation of your component inside which you change the padding. You can add these css in global stylesheet without turning off view encapsulation.

How do I change the color of my mat form field?

Go to Node_modules → @angular → material → prebuilt-themes → indigo-pink. css → Find mat-form-filed-appearance-outline, and then change your color.


1 Answers

Material v7.3.4

.mat-form-field-outline-start, .mat-form-field-outline-end {
    border-radius: 0 !important;
}
like image 180
João Portella Avatar answered Sep 30 '22 03:09

João Portella