How to change height in mat-form-field
Add these to your CSS in the your original stackblitz
::ng-deep .mat-form-field-flex > .mat-form-field-infix { padding: 0.4em 0px !important;}
::ng-deep .mat-form-field-appearance-outline .mat-form-field-label { margin-top:-15px; }
::ng-deep label.ng-star-inserted { transform: translateY(-0.59375em) scale(.75) !important; }
UPDATED: with transition for the label...
::ng-deep .mat-form-field-flex > .mat-form-field-infix { padding: 0.4em 0px !important;}
::ng-deep .mat-form-field-label-wrapper { top: -1.5em; }
::ng-deep .mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label {
transform: translateY(-1.1em) scale(.75);
width: 133.33333%;
}
Angular 8: Change Height in Mat-form-field to Specific pixel number
Not sure exactly from where you want to cut, so I'll give you a few options and you can decide what and how much you want to cut in order to get the right size
To remove the margins from top and bottom
::ng-deep mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper {
margin: 0;
}
To change the font size
mat-form-field {
font-size: 10px;
}
To remove the hint and errors (space in the bottom)
::ng-deep .mat-form-field-wrapper {
padding-bottom: 0;
}
::ng-deep .mat-form-field-subscript-wrapper {
display: none;
}
To change the padding (default is 1em for top and bottom)
::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
padding: .5em;
}
Note: if you choose to do the last one you will also have to change the top
or margin-top
of the .mat-form-field-label
like this
::ng-deep .mat-form-field-appearance-outline .mat-form-field-label {
top: ...;
margin-top: ...;
}
How shall I adjust the size of mat-form-field mat-chip?
You can override the styles from angular/material.
In this case, it is enough to simply add the same property in a style rule in your component's CSS file. Your component CSS has higher specificity than the mat-chip rules below.
The height of the chip is determined by the following rule:
.mat-standard-chip {
min-height: 32px;
}
So you could override this to make the chip smaller.
You may also want to modify the font-size with the following rule:
.mat-chip {
font-size: 14px;
}
Related Topics
Validation Using Yup to Check String or Number Length
Preventing Page from Scrolling on Focus Switching
How to Access the Value of a Promise
React Passing Import Name as Prop and Adding to Image Src
Chat Box, Auto Scroll to Bottom
How to Deeply Remove Null Values, Empty Objects and Empty Array from an Object
How to Split Date and Time from the Datetime Variable in JavaScript
How to Add Scroll Event in React Component
How to Pass JavaScript Confirm Variable to PHP Variable
How to Get Parent Width/Height in React Using Hooks
Typescript - Possible to Disable Type Checking
Increase Counter Value Upon Button Click
Jquery Get Closest Td Text Value
How to Show a Confirm Message Before Delete
How to Get the Id of a Button That Was Clicked - Reactjs
How to Create a Remember Me Function in Login Without Using Form in JavaScript or Jquery
Search Bar With Dropdown Results
Prevent Html5 Videos from Downloading the Files on Mobile - Videojs