Reputation: 2603
We are using angular material in our app. I am trying to find a way to make the floating labels of all fields bigger.
I can, of course, just drive it by additional class, but: * I will have to do it on each and every field * In case of an outlined field (as shown), the text will be on top of the border.
How can I make the change globally? and how to make sure that the space for the label text also increased?
Upvotes: 4
Views: 2794
Reputation: 325
I handled this by overriding a couple things in a global SCSS/CSS file.
.mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label,
.mat-form-field-appearance-outline.mat-form-field-can-float .mat-input-server:focus + .mat-form-field-label-wrapper .mat-form-field-label {
transform: translateY(-1.7175em) scale(1);
}
.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label {
letter-spacing: 0.025rem;
line-height: 1.34;
font: {
size: 0.75rem;
weight: 600;
}
mat-label {
background: white;
&::after {
background: white;
content: '';
display: inline-block;
width: 0.25rem;
}
}
Upvotes: 1
Reputation: 26
They are all dominated by the selector of .mat-form-field-label
that you can manipulate your self, but it will change all the behaviours of it's translation and scale from label to floating label so it's a little bit complicated if you can not handle modifications of its translation and typography.
Upvotes: 0