Button has dense style.
Mat icon button with text.
Link to a url when clicked.
We have to import maticonmodule from angular material modules.
The approach above worked acceptably fine with different font sizes of the text around the icon the icon is always vertically centered if that s what you want.
That is the difference between icons that look in perfect alignment with text and icons that look slightly off.
Force browser to redirect outside component router space.
For more information see the mdc button docs.
Import maticonmodule from angular material icon.
For buttons with both icons and text use the mdc button component.
Text label of button.
Eventcallback mouseeventargs event occurs when.
To add the icon to mat button text we need to add mat icon before the text of button as shown below h3 mat button with icon and text h3 button mat raised button color primary mat icon shopping cart mat icon add to cart button.
Specifies an button s icon.
Ui component infrastructure and material design components for mobile and desktop angular web applications.
Adjust these values accordingly top.
I created the additional style to avoid breaking angular material components that are using mat icon and expecting it to be of default size and default alignment.
Mat icon is part of angular material module called maticonmodule we can use font ligature as an icon by putting the ligature text in mat icon component.
If a text label is not used an icon should be present to signify what the button does.
Install with bower install with npm view source on github doc humanizedoc directivebrackets doc restrict doc humanizedoc directivebrackets view demo view source on github.
For example mat icon home mat icon displays home icon.
When all is said and done there is a solid and simple recipe for getting icons exactly where you want to line up with text icon position.