Skip to main content

MenuItem

shadow

MenuItem is a child of the Menu. element and represents a navigation item within it. It can display a submenu with additional navigation items and also allows icons to be displayed. For examples of using MenuItem, go to the Menu element documentation page.

Basic usage

This example shows wje-menu-item in its most common context: inside an active wje-menu with icons, dividers, labels, and nested submenu items.

In the nav style, pay attention to nested items, checked state, and the combination of start, end, and submenu slots.

When to use

Use wje-menu-item when users need to understand location, move between views, or traverse hierarchy.

When not to use

Do not combine multiple competing navigation patterns for the same user flow.

Accessibility

Ensure visible active/selected states, predictable tab order, and clear control naming.

Best Practices

  • Keep URL state and UI navigation state synchronized.
  • Use consistent labels across menu, breadcrumbs, and tabs.
  • Add context for deep structures (breadcrumbs, headings, icon cues).

Attributes and Properties

customEvent

DescriptionSets the text value stored in custom-event.
Attributecustom-event
Typestring
Default-

Events

NameDescription
wje-menu-item:clickEmitted when the component is clicked.

Methods

No public methods available for this component.

CSS Shadow Parts

NameDescription
nativeThe native part of the menu item.
submenuThe submenu part of the menu item.

CSS Custom Properties

NameDescription
--wje-menu-item-colorSets the text color of a menu item. Accepts any valid CSS color value.
--wje-menu-item-backgroundDefines the background color of a menu item. Default is transparent. Accepts any valid CSS color value.
--wje-menu-item-color-hoverSpecifies the text color of a menu item when hovered. Accepts any valid CSS color value.
--wje-menu-item-background-hoverSets the background color of a menu item when hovered. Accepts any valid CSS color value.
--wje-menu-item-color-focusDefines the text color of a menu item when focused. Accepts any valid CSS color value.
--wje-menu-item-background-focusSpecifies the background color of a menu item when focused. Accepts any valid CSS color value.
--wje-menu-item-color-activeSets the text color of a menu item when active. Accepts any valid CSS color value.
--wje-menu-item-background-activeSpecifies the background color of a menu item when active. Accepts any valid CSS color value.
--wje-menu-item-padding-topSpecifies the top padding inside a menu item. Accepts any valid CSS length value (e.g., px, rem).
--wje-menu-item-padding-bottomSpecifies the bottom padding inside a menu item. Accepts any valid CSS length value (e.g., px, rem).
--wje-menu-item-line-heightSets the line height for the text within a menu item. Accepts any valid CSS length value.
--wje-menu-submenu-offsetDetermines the horizontal offset of a submenu relative to its parent. Accepts any valid CSS length value.
--wje-menu-item-icon-visibilityControls the visibility of the icon in a menu item. Accepts visible, hidden, or collapse.
--wje-menu-item-safe-triangle-cursor-xSpecifies the x-coordinate of the cursor for the safe triangle area. Used for managing hover or focus transitions between menu items and submenus.
--wje-menu-item-safe-triangle-cursor-ySpecifies the y-coordinate of the cursor for the safe triangle area.
--wje-menu-item-safe-triangle-submenu-start-xDefines the x-coordinate where the submenu's safe triangle starts. Helps prevent accidental submenu closing when navigating.
--wje-menu-item-safe-triangle-submenu-start-yDefines the y-coordinate where the submenu's safe triangle starts.
--wje-menu-item-safe-triangle-submenu-end-xSpecifies the x-coordinate where the submenu's safe triangle ends.
--wje-menu-item-safe-triangle-submenu-end-ySpecifies the y-coordinate where the submenu's safe triangle ends.

Slots

NameDescription
defaultThe default slot for the menu item.
startThe slot for the start of the menu item.
endThe slot for the end of the menu item.
submenuThe slot for the submenu of the menu item.