0

Per this forum thread, a proper menubar widget is promised for Vaadin Flow in version 14 for June 2019 next year, according to the Components page in the manual.

Until then, that page suggests a menu bar can be jerry-rigged in version 12 using Select and ContextMenu.

MenuBar

Planned for Vaadin 14. Can be made currently by combining Select (V12) and ContextMenu (V12)

(a) I cannot find either Select or ContextMenu in the version 12 JavaDoc.

(b) Has anyone an example implementation to share?

Community
  • 1
  • 1
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • Platform version 12 is under construction and will be released in the beginning of December, the JavaDocs of these components, etc. are to arrive by then. The release schedule is here: https://vaadin.com/roadmap – Tatu Lund Nov 09 '18 at 07:53

1 Answers1

1

ContextMenu is a transitive dependency in at least 12.0.0.beta1

Some very basic example (Groovy 2.5):

def fileMenu
content.add(
        fileMenu = new Div(new Text("File")).tap{
            style.set('cursor', 'pointer')
        },
)
new ContextMenu(fileMenu).tap{
    openOnClick = true // allows opening with a left-click
    addItem("Open", {println "open"})
    addItem("Save", {println "save"})
}

Given the crude nature of that and the relative ease to add something from webcomponents.org you might be better off with something else. Yet there seems to be just one classic menu bar (https://www.webcomponents.org/element/wiredjs/wired-menu-bar) for mocking UIs.

cfrick
  • 35,203
  • 6
  • 56
  • 68