Docs

Documentation versions (currently viewingVaadin 25 (prerelease))

Menu Bar Styling

Styling API reference for the Menu Bar component.

Style Variants

The following variants are supported by the Menu Bar:

Variant Description Supported by

primary

Corresponds to the primary button variant. Recommended for drop-down buttons use case

Aura, Lumo

tertiary

Corresponds to the tertiary button variant, omitting the background color

Aura, Lumo

tertiary-inline

Corresponds to the tertiary inline button variant

Lumo

small

Reduces the size of menu bar buttons

Lumo

large

Increases the size of menu bar buttons

Lumo

contrast

Recommended as an additional color option

Lumo

icon

Recommended for icon only menu bar buttons

Lumo

dropdown-indicators

Used to visually indicate buttons with sub-menu

Lumo

end-aligned

Used to align buttons to the end of the menu bar

Aura, Lumo

Source code
MenuBarStyles.java
menu-bar-styles.tsx
menu-bar-styles.ts
Tip
Customize Default Menu Button Styles
The standard Menu Button styles can be adjusted using the Button style properties. These variants should be used only to differentiate special instances of the component.

Alignment

Top-level items are aligned by default to the start of the Menu Bar. Use instead the end-aligned theme variant to align them to the end.

Source code
MenuBarRightAligned.java
menu-bar-right-aligned.tsx
menu-bar-right-aligned.ts

Menu buttons with sub-menu can be visually identified from items that trigger an action immediately using dropdown-indicators theme variant.

Source code
MenuBarDropDownIndicators.java
menu-bar-drop-down-indicators.tsx
menu-bar-drop-down-indicators.ts

Styling Menu Items

Individual menu items can be styled by applying custom class names to them, and writing CSS style blocks targeting those class names. Notice that root-level menu items in the Menu Bar are wrapped in vaadin-menu-bar-button elements, which inherit the class names from the items within them.

Source code
MenuBarClassName.java
menu-bar-class-name.css
menu-bar-class-name.css
menu-bar-class-name.tsx
menu-bar-class-name.css
menu-bar-class-name.css
menu-bar-class-name.ts
menu-bar-class-name.css
menu-bar-class-name.css

CSS Selectors

The following CSS selectors can be used in stylesheets to target the various parts and states of the component. See the Styling documentation for more details on how to style components.

Root element

vaadin-menu-bar

States

Disabled

vaadin-menu-bar[disabled]

Single button visible

vaadin-menu-bar[has-single-button]

Buttons

Button element

vaadin-menu-bar-button

Button text

vaadin-menu-bar-button::part(label)

Hovered button

vaadin-menu-bar-button:hover

Focused button

vaadin-menu-bar-button[focused]

Disabled button

vaadin-menu-bar-button[disabled]

Button with a menu

vaadin-menu-bar-button[aria-haspopup]

Button with opened menu

vaadin-menu-bar-button[expanded]

Overflow button

vaadin-menu-bar-button[slot="overflow"]

Overflow button icon

vaadin-menu-bar-button[slot="overflow"] > [aria-hidden]

Button rich content wrapper

vaadin-menu-bar-button > vaadin-menu-bar-item

Button icon

vaadin-menu-bar-button > vaadin-menu-bar-item > vaadin-icon

Sub-menu element

vaadin-menu-bar-submenu

Sub-menu background

vaadin-menu-bar-submenu::part(overlay)

Sub-menu content wrapper

vaadin-menu-submenu::part(content)

Nested sub-menu

vaadin-menu-bar-submenu[modeless]

Items

Item element

vaadin-menu-bar-item

Item content wrapper

vaadin-menu-bar-item::part(content)

Checked item indicator

vaadin-menu-bar-item[menu-item-checked]::part(checkmark)

Checked item indicator icon

vaadin-menu-bar-item[menu-item-checked]::part(checkmark)::before

Submenu indicator icon

vaadin-menu-bar-item::after

Separator element

vaadin-menu-bar-submenu [role="separator"]

Item States

Hovered item

vaadin-menu-bar-item:hover

Focused item

vaadin-menu-bar-item[focused]

Disabled item

vaadin-menu-bar-item[disabled]

Item with a nested sub-menu

vaadin-menu-bar-item[aria-haspopup]

Item with expanded sub-menu

vaadin-menu-bar-item[expanded]

Checked item

vaadin-menu-bar-item[menu-item-checked]