{"id":579,"date":"2019-09-06T03:15:00","date_gmt":"2019-09-06T03:15:00","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/09\/06\/change-default-icon-for-menu-items-in-magento-2-backend\/"},"modified":"2025-07-21T15:34:31","modified_gmt":"2025-07-21T10:04:31","slug":"change-default-icon-for-menu-items-in-magento-2-backend","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/change-default-icon-for-menu-items-in-magento-2-backend\/","title":{"rendered":"How To Change Default Icon For Menu Items in Magento 2 Backend"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The Magento 2 platform allows the developers to develop and add custom modules in the store to avail the extended functionality either for improved customer experience or easy administration task. These custom modules can be accessed from the Magento 2 admin panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, these custom modules are assigned the \u201chexagonal\u201d icon by default as shown in the image below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/09\/1_Default.png\" alt=\"Magento 2 admin panel\" class=\"wp-image-6420\"\/><\/figure>\n\n\n<p>However, you can <i><strong>change default icon for menu items in Magento 2 backend<\/strong><\/i> and the post gives the programmatic method for the same.<\/p>\n<p>Why would you do so?<\/p>\n<p>The reasons for changing the default icon in the <a href=\"https:\/\/meetanshi.com\/blog\/add-custom-menu-item-in-magento-2-frontend\/\">menu for a custom module in Magento 2<\/a> backend are:<\/p>\n<ol>\n<li>Symbolic representation for reflecting the functionality is always a good thing to do!<\/li>\n<li>Branding with the custom icon of your company<\/li>\n<li>The fellow admins or store owner can get the overview of the module with a custom icon and easily understand it.<\/li>\n<li>Differentiating the custom modules from the default ones<\/li>\n<li>Unique and cool visual appearance with an attractive appeal<\/li>\n<\/ol>\n<p>Owing to the above reasons, you may take the efforts to follow the below method to customize the menu items&#8217; icons for custom modules in the admin panel of Magento 2:<\/p>\n<h2>Method to Change Default Icon for Menu Items in Magento 2 Backend:<\/h2>\n<p>1. Create <strong>app\/code\/Meetanshi\/HelloWorld\/etc\/adminhtml\/menu.xml<\/strong><\/p>\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:module:Magento_Backend:etc\/menu.xsd\">\n    &lt;menu>\n        &lt;add id=\"Meetanshi_HelloWorld::helloworld\" title=\"Hello World\" module=\"Meetanshi_HelloWorld\" sortOrder=\"51\" resource=\"Meetanshi_HelloWorld::helloworld\"\/>\n        &lt;add id=\"Meetanshi_HelloWorld::post\" title=\"Manage Posts\" module=\"Meetanshi_HelloWorld\" sortOrder=\"10\" action=\"meetanshi_helloworld\/post\" resource=\"Meetanshi_HelloWorld::post\" parent=\"Meetanshi_HelloWorld::helloworld\"\/>\n        &lt;add id=\"Meetanshi_HelloWorld::hello_configuration\" title=\"Configuration\" module=\"Meetanshi_HelloWorld\" sortOrder=\"99\" parent=\"Meetanshi_HelloWorld::helloworld\" action=\"adminhtml\/system_config\/edit\/section\/helloworld\" resource=\"Meetanshi_HelloWorld::helloworld_configuration\"\/>\n    &lt;\/menu>\n&lt;\/config><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create <strong>app\/code\/Meetanshi\/HelloWorld\/view\/adminhtml\/web\/css\/helloworld.css <\/strong>file with the following code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">.admin__menu .level-0.item-helloworld > a:before {\n    content: url('..\/images\/meetanshi.svg');\n    height: 28px;\n    margin: 0 auto;\n    width: 30px;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Upload your icon to <strong>app\/code\/Meetanshi\/HelloWorld\/view\/adminhtml\/web\/images\/<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Create <strong>app\/code\/Meetanshi\/HelloWorld\/view\/adminhtml\/layout\/default.xml <\/strong>file with the following code<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n    &lt;head>\n        &lt;css src=\"Meetanshi_HelloWorld::css\/helloworld.css\"\/>\n    &lt;\/head>\n&lt;\/page><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5. Run the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php bin\/magento setup:static-content:deploy -f --area adminhtml\nphp bin\/magento cache:clean<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The custom menu item icon in the backend:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/09\/2_Custom.png\" alt=\"custom menu item icon\" class=\"wp-image-6421\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Please share the above solution with as many developers as possible via social media platforms.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Magento 2 platform allows the developers to develop and add custom modules in the store to avail the extended functionality either for improved customer&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-579","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=579"}],"version-history":[{"count":6,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/579\/revisions"}],"predecessor-version":[{"id":18764,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/579\/revisions\/18764"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}