Codepen and steps to reproduce the issue.
Mat icon next to text.
For example mat icon home mat icon displays home icon.
What is the expected behavior.
Surprisingly it added padding to both the icon and the div.
Download on desktop to use them in your digital products for android ios and web.
Hi guys what is the correct code to use when placing an icon next to a piece of text.
Icons ought to be treated a lot like typography.
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.
What is the current behavior.
I have tried various ways but the text and icon are never horizontally aligned.
Whats the correct way of placing an icon next to text.
Mat icons used as a matprefix or matsuffix should vertically align with the input text placeholder.
They re either used in conjunction with text or in place of it so setting the size of the icon to the size of the text next to it is important for the same reason we like consistently sized letters.
That seems broken to me as the icon is outside of the div.
A telephone icon next to a phone number.
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.
We have to import maticonmodule from angular material modules.
This doesn t mean icons need to be 16px if your content font size is also 16px.
Icons are positioned too high.
Import maticonmodule from angular material icon.
Bug feature request or proposal.