So i have created a Magento 2 theme based on Blank, and the customer wants the submenu of the navigation to be a big window instead of the little dropdown that comes out of the box. They also want custom links in this window..

Im totally lost, I have inserted the topmenu.phtml into the theme and from there i can only tweak so much.. It would be great if i could get the submenu out of the menu such as this:

<nav class="custom navigation" data-action="navigation">
<ul data-mage-init='{"menu":{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'>

    <?php /* @escapeNotVerified */ echo $_menu; ?>
    <div class="custom-submenu">
    <!-- custom div for submenu  -->

    <?php /* @escapeNotVerified */ echo $block->getChildHtml(); ?>

But the function for $_menu is quite complicated and i havent managed to get the backend of topmenu.php into my project properly.

Moving stuff around in the default.xml doesnt help since i need to build a layout for the block/div with custom links and styling.

What do i do? Buying extensions like mega-menu is not an option.. Building a whole new module with the category-navigation seems super hard and overkill?

1 Answer 1


I've also been looking into this for the past few days. The Magento 2 blank theme uses out of the box jquery ui for the menu. I was able to use CSS to stretch the drop down to full width but I couldn't get custom links working in this or multiple columns under one drop down. I think the only option is to write a module or plugin to reformat the html. Remember that if you write a plugin you can only use this to override public methods. I'm looking at overriding or writing something to run before/after the getHTML function in Magento\Theme\Block\Html\Topmenu

Another possibility may be to remove the menu.js jquery part and write something entirely custom for this but I think you still wouldn't be able do anything about custom links without a plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.