Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Angular 5 Material input placeholder? [duplicate]

Tags:

How do you change the placeholder colour on a angular/material input placeholder?

<mat-form-field>     <input matInput placeholder="Name">   </mat-form-field> 
like image 834
FirmCiti Inc Avatar asked Nov 17 '17 16:11

FirmCiti Inc


People also ask

How do I change placeholders?

Select the placeholder, position the pointer over a sizing handle, and then drag the handle until the placeholder is the size that you want. Select the placeholder, and then drag it to its new location. Select the placeholder, click the Format tab, and then make the changes that you want.

What is placeholder in angular?

Placeholders can be used to enhance the experience of your application. You will, need set some custom widths to toggle their visibility. Their appearance, color, and sizing can be easily customized with our utility classes.


1 Answers

In the last version of angular you can remove the placeholder in the input and add a mat-placeholder in the mat-form-field and custom the css with a class

html :

<mat-form-field>     <input matInput type="text">     <mat-placeholder class="placeholder">Search</mat-placeholder> </mat-form-field> 

css:

.mat-focused .placeholder {     color: #00D318; } 
like image 120
Wenakari Avatar answered Oct 27 '22 02:10

Wenakari