Menu Bar Component | Vaadin components

This topic is the discussion thread for the Vaadin documentation page Menu Bar Component | Vaadin components.

Questions, feedback, and comments are welcome here.

addComponentColumn() renders pretty slowly with MenuBar. Are there examples how to add such a menubar to grid using LitRenderer?

https://vaadin.com/docs/latest/example?path=component/menubar/menu-bar-combo-buttons.ts

MenuBar menuBar = new MenuBar();
MenuItem item = menuBar.addItem("Share");
SubMenu subMenu = item.getSubMenu();
subMenu.add(new Hr()); <-- This is deprecated since Vaadin 24.8


Use subMenu.addComponent(new Hr()); instead


Thanks for the heads up, created a PR to get this up to date: https://github.com/vaadin/docs/pull/4443

There's a bug, or at least I think so, when using

menuItem.addThemeNames 

If you're like me, and you want to style your MenuItems with different colors, you might have discovered the following:

menuItem.addThemeNames("error");

Which works fine, but as soon as you also want to see the dropdown indicators you'll run into issues, or at least that was the case for me.

Because adding the Theme Name doesn't actually add it, as stated in the name, but instead, completely overrides any previously added Theme Name, including the dropdown indicators, which will result in them not appearing.

As far as I know, you can only really prevent this, by manually adding the dropdown indicators Theme Name, like so:

menuItem.addThemeNames("dropdown-indicators error");

I have 2 menu bars in a horizontal layout. The first has some actions at the left side, the other is on the right side. If I shrink the space I see the right buttons fast blinking. This happens directly after I upgrade from 25.0.0 to 25.1.8.

I have a second question. I want to use a separator between some actions. Is there a way to do this?

First question: please create a reproducible example and file a ticket in GitHub: https://github.com/vaadin/flow-components

Second question: Did you already check this: thttps://vaadin.com/docs/latest/components/menu-bar#dividers

The Combobutton https://vaadin.com/docs/latest/components/menu-bar (this doc-page itself shows it quite blatantly) looks really weird with aura. The height of the container holding the arrow-icon is for some unexplainable reason 4 pixels less than the other components in the menu bar. this honestly looks really crappy.

Thanks for pointing that out. It was indeed really crappy. The visual issue has been fixed now (changed the icon height from 1rem to 1lh). Not the best example still, how it replaces the built-in dropdown indicator in Aura with a custom icon, and doesn't have an accessible label for that "more options" button.