Please implement a feature to apply at least class attribute to the entire menu (=the <ul> element). This would allow to share styling among menus (such as when you have separate menus for each language).


I need that also.


I created a custom subtheme of Bootstrap and would love to be able to create stacked menus. To do so, I need to add the "nav nav-stacked" class to the ul tag. Currently, and amazingly frustratingly, this incredibly simple task cannot be done easily or without hacking code in Drupal.


This would make my life a lot easier. I would be happy just with the 'class' option, similar to how the block_class module works.


This would be great for using with bootstrap nav classes.

This would be wonderful!


Not only a class but ID to. Just like menu items (li).

We really need menu (ul) to have and ID and class cause of :target element!

Issue summary:View changes

This would be helpful for me as well (adding classes to <ul> and <li> menu elements). I'm surprised it's not already in this module.

is this a duplicate of ?

@bdanin, as I read it, this is not a duplicate of #1488960: Attributes for LI element, which speaks of allowing *menu-item* classes to move from the <a> tag to the <li> wrapper tag.

This issue on the other hand seems to be primarily about exposing a setting (eg on the menu settings page) to specify a class and/or ID for an entire menu's <ul> tag.

From a traditional themer point of view this seems like a ridiculous request because normally one would be able to style any menu using the existing classes provided on the wrapper divs in a theme, but with the advent of frameworks like bootstrap, i can see that it does make sense to expose the class/id attributes for the <ul> itself in some cases.

It seems that with bootstrap using either LESS or SASS, it would be easy to extend an already existing class to the specific <ul> item without needing to append a class there. Although adding a class there might be faster / easier, especially for those that don't have access to compile the CSS. At this point, it would probably make more sense to add that ability to the D8 version.

It would be very helpful in D7 as well. Default classes like menuitem1, menuitem2, menuitem3 + active, first, last etc. is a must in any cms.

Here's one way I've done this in the past, it uses a couple very well maintained modules and I haven't experienced conflicts:

1) Use menu_block
2) Use block_class

Add the class to the menu block where needed. It doesn't add it to the <ul> item directly, but you can apply classes to entire menus this way very quickly and easily.

@#13, those are excellent workarounds, but without the ability to actually modify the class on the <ul>, they remain just workarounds. This is still a valid feature request that belongs in this module.