How I to change default font Icon in menu admin for a custom module in Magento 2?
To change default font Icon in menu admin for a custom module in Magento 2, you should:
- Create custom icon .svg with inkscape software
- Create font icon of that .svg icon with help of IcoMoon.io
- Go to lib/web/fonts
- create your module folder.
- injected it inside Magento 2 without touching the core files
- go to app/design/adminhtml/Magento/backend
- create folder dubbed Package_Modulename/web/css/source/
- Create _module.less file in a source folder
- inside file _module.less add the following lines :
1 2 3 4 5 6 7 8 9 10 11 12 |
@modulename-icons-admin__font-name-path: '@{baseDir}fonts/modulename/icomoon'; @modulename-icons-admin__font-name : 'modulename'; .font-face( @family-name:@modulename-icons-admin__font-name, @font-path: @modulename-icons-admin__font-name-path, @font-weight: normal, @font-style: normal ); .admin__menu .item-modulename.parent.level-0 > a:before { font-family: @modulename-icons-admin__font-name; content: "\e800"; } |
Source (