menu columns overview
menu columns overview
menu columns footer

This project is not covered by Drupal’s security advisory policy.

What it does

Menu Columns is a mega menu module for Drupal 10, 11 and 12. It answers one question for every dropdown in a menu: how is it divided? How many columns, and how many children in each. It then hands your theme the children already divided up.

A multi-column dropdown usually falls to CSS, which can give you even columns and nothing more. The moment a dropdown wants three children in its first column and six in its second, someone ends up typing columns-3 split-2-1-5 into a menu item's CSS classes field and hoping the theme agrees. This module makes those choices proper settings, saved against the menu and the menu item, where a site builder can reach them.

By default it draws nothing itself. It works out the division and gives it to your theme. If you would rather not draw one, it also ships a complete design you can switch on per menu: a bar with panels that open, a burger at narrow widths, or a row that is always open for a footer.

Why this instead of TB Mega Menu, We Megamenu or Ultimenu?

Most mega menu modules are builders. They bring their own layout interface and render their own markup, and the theme fits around what they produce. That is exactly right when you want a mega menu handed to you finished, and those modules do it well.

Menu Columns starts from the other end.

  • It does not own your markup. Leave the bundled design off and nothing of this module reaches the page but two classes and a variable. Your Twig, your CSS, your design system nothing to override and nothing to fight. For most people this is the reason to pick it.
  • The design is opt-in, one menu at a time. Main navigation drawn by your theme and the footer drawn by the module, on the same site, decided menu by menu.
  • It is not only for mega menus. Set a menu to one row, always open and the same column logic lays out a footer. One module instead of two.
  • Every dropdown may differ. One parent can open three columns while the next opens five, and each decides how many of its children fall in each column. Column count, items per column and column widths are menu defaults that any single menu item overrides on its own form at any depth, including a dropdown inside a dropdown.
  • Visibility rules that cache correctly. Show a menu, or one item in it, by role, by language and by path. The rules are applied as the menu tree is built, so the cache contexts the answer depended on are recorded with it instead of being quietly dropped.
  • Per-menu permissions. Give an editor the footer without giving them the main navigation.
  • Current with core. Object-oriented #[Hook] implementations, typed services, and support for Drupal 10.3, 11 and 12.

What you get

  • Columns per dropdown a column count, items per column (2, 1, 5) and column widths as shares (2, 1, 1), set per menu and overridable on each dropdown.
  • However deep the menu goes a dropdown inside a dropdown is laid out on its own terms, at any depth.
  • Blocks, views and content in a panel put a block, a view display, or a node drawn in any view mode beside the links, or in a column of its own.
  • Footers too set a menu to one row, always open and the same columns lay out a footer: one column per top-level item, with blocks where the links run out.
  • Icons a built-in set, a class from your own icon font (Font Awesome, Material Symbols), or pasted SVG, on either side of the label. Pasted markup is reduced to the shapes it draws, on the way into storage and again every time it is shown.
  • Your own classes on every part a field each for the panel, the column ul, the child li and the child link a, set per menu and overridable on any dropdown. Utility classes from Tailwind, Bootstrap or your own design system go straight on, with no template override.
  • Colours per menu bar, dropdown, the levels nested inside, and the colour a link takes under the pointer.
  • Keyboard and screen reader support arrow keys through a panel, Escape to close, focus returned to the trigger, and motion dropped for anyone who asks for less of it.
  • Visibility rules show or hide a menu or a single item by role, by language, and by path.
  • Per-menu permissions let an editor set up one menu without giving them every menu on the site.
  • A template per part the bundled design is a theme hook per piece, so you override one list or one link without copying the whole design.

Theming it yourself

Leave the bundled design off and the choices reach your theme two ways: as menu-columns-3 and menu-columns-split-2-1-5 classes on the item and its link, and as an item.menu_columns variable holding the children already divided into columns, ready to loop.

Installation

composer require drupal/menu_columns
drush en menu_columns

Then go to Structure › Menu columns, tick the menus you want laid out, and open one to set it up. Nothing on your site changes until you tick a menu, and nothing is drawn differently until you switch the bundled design on so it is safe to install and look around.

Requirements

Drupal 10.3, 11 or 12. PHP 8.1 or later. Core's Custom Menu Links, Menu UI and Path Alias modules.

Project information

Releases