Intro
The menu is a UI component used to display a list of actions. Actions can be grouped in submenus.
Menu
Component availability
The menu component is available in the following libraries:
When to Use
Use the menu to:
- Display more than one action.
- Keep the user in the current context.
- Display only a small number of actions.
Don’t use the menu to:
- Provide only one option. Use a button instead.
- Provide a primary default action with additional secondary actions – use a split button instead.
- Use a limited number of menu items to maintain clarity and support quick scanning.
- Use single-level navigation or add submenus for nested levels. Keep nesting minimal to avoid complexity.
- Use single- or multiple-selection patterns based on the interaction requirement.
- When incorporating icons in menu list items, maintain consistent spacing across all to ensure proper alignment and improve readability.
- Use separators to group-related actions. Avoid excessive use to maintain scannability.
- Display tooltips for menu items when text is truncated or when additional clarification is required.
Anatomy
Menu
- Menu: Container shown as an overlay.
- Menu Item: List item that represents an action.
- Separator (optional): Horizontal line that groups the menu items.
Menu anatomy
Menu Item
- Icon (optional): Indicates the action triggered by the menu item.
- Text: Describes the action that is triggered by the menu item. The text is mandatory.
- Additional text, icon, or both (optional): Displayed at the end of the menu item to indicate a keyboard shortcut or a checkmark for selection.
- Navigation indicator: Indicates that a submenu is available for the menu item.
The menu item adapts automatically based on the included elements.
Menu item anatomy
Types
Standard menu
The standard menu supports a single level of navigation. Use it for a simple list of actions without additional hierarchy.
Standard menu without icons, navigation elements, or shortcuts
Menu with submenus
A menu with submenus supports nested navigation, allowing related actions to be grouped without overcrowding a single level. Submenus help organize the menu items logically, but the number of levels should be limited to keep navigation clear and easy to use.
Menu with submenus
Menu with icons
A menu that uses icons alongside text labels enhances visual recognition and usability. When icons are included, ensure consistent spacing is maintained across all menu items to preserve alignment and improve readability.
Menu with icons
Menu with shortcuts
A menu with shortcuts supports access to items using key combinations.
Menu with shortcuts
Menu with single- and multi-select items
When there is need to show which option or options are active within a group of related menu items, a menu with single- or multi-selection can be used.
A. Menus with single-select items allow users to select only one item at a time. Selecting a new item automatically deselects the previously selected one.
B. Menus with multi-select items allow users to select or deselect several items at a time.
Menu with single- (A) and multi-select (B) items
Context menu
The menu component can be used as a context menu, providing similar behavior to a standard menu. Right-clicking opens the context menu with actions relevant to the selected item or focused area.
Context menu
Menu item options
A menu item can include an icon, text, a shortcut, or a selection indicator.
The menu item supports displaying both a shortcut and a checkmark. If a navigation arrow is present, the shortcut and checkmark are not displayed.
A: Text only
B: Text and navigation indicator
C: Text and shortcut
D: Text and checkmark
E: Text, shortcut, and checkmark
All menu items options can be displayed with or without an icon.
Menu item options
States
Component states
The menu item supports two component states: enabled and disabled.
A. Enabled: Displays the interactive state.
B. Disabled: Displays a non-interactive state.
Component states
For more information, see Component States.
Interaction states
The menu item has three interaction states: regular, hover, and down.
B. Hover: Displays the hover state when the cursor is over an enabled menu item.
C. Down: Displays the down state while the menu item is pressed.
Interaction states
For more information, see Interaction States.
Focus state
The focus state indicates which element is focused. Keyboard and assistive technology users rely on the focus state to follow the interaction.
Focused menu item in enabled (A) and disabled (B) state
For more information, see Focus States.
Selection states
The menu has two types of selection states, depending on the menu item used: a navigation item or an item with a checkmark.
Selection states of navigation menu item
B. Selected indicates the menu item that triggered the submenu.
C. Selected hover displays the hover state for a selected item.
Selection states of menu navigation item
Selection states of checkmark menu item
B. Selected indicates that the menu item with checkmark was selected.
Selection states of menu item without and with a checkmark
For more information, see Selection States.
Behavior and Interaction
Level navigation
A: Hovering applies hover and focus states.
B: Hovering over an item with a navigation indicator applies selected hover and focus states, and opens the submenu.
Level navigation
C: Hovering over an item with a navigation indicator from the submenu applies selected hover and focus states, and opens the second submenu.
Navigation with second submenu
Mouse interaction
Opening a menu
Users can open a menu by selecting a calling element (for example, a menu button) or by triggering a context menu. In both cases, the menu item automatically receives focus when the menu opens.
Opening a menu
Opening a context menu
Closing a menu
The menu closes after selecting an item, clicking outside the menu, or interacting with the calling element. This behavior also applies to the context menu.
Closing a menu with triggering an action
Closing a menu without triggering an action
Touch interaction
On touch devices, the behavior matches mouse interaction without the hover state. Users can interact via tap and long tap gestures.
Opening a menu
When tapping the calling element, the menu opens and focus state automatically sets to the first menu item.
Opening a menu
Opening a context menu
Long tapping the calling element opens the context menu. Focus moves to the first menu item.
Opening a context menu
For more information, see Gestures.
Tooltips
Provide a tooltip when the menu item text is truncated or requires clarification.
Truncated menu item with a tooltip
For more information, see Using Tooltips.
Responsiveness
The menu width adjusts to its content.
Menu with different widths depending on the menu items’ length
The menu supports cozy and compact content densities.
A: Compact content density minimizes control dimensions to display additional information within the interface, optimizing usability for mouse and keyboard interactions.
B: Cozy content density offers expanded control dimensions designed for intuitive fingertip interaction, ensuring optimal usability on touch-enabled devices.
Menu with compact (A) and cozy (B) content densities
For more information, see Content Density.
On mobile devices, the menu opens in full-screen mode to enhance usability. This layout allows the application to display a menu title, giving users clean context. To close the menu, users can tap the Cancel button in the footer.
Menu on mobile device
Accessibility
SAP follows international standards, such as WCAG and WAI-ARIA, and strives to make our business solutions accessible and inclusive.
For more information, see Accessibility in SAP Fiori and the Accessibility Design Tools Handbook.
Keyboard navigation
The following keyboard combinations are supported by the menu component.
Screen reader support
For additional details on screen reader support and Accessible Rich Internet Applications (ARIA), see UI5 Screen Reader Support and WAI-ARIA-Authoring.
Content
Wrapping and truncation
Display the full menu item text when possible. To accommodate this, the menu width can expand up to a predefined maximum. If space is limited, the text may be truncated. Menu items do not support text wrapping.
Menu with different widths depending on the menu items’ length
For more information, see Wrapping and Truncation.
Localization
The menu and menu item support left-to-right (LTR) and right-to-left (RTL) reading directions.
Menu – left-to-right
Menu – right-to-left
Framework Comparison
There are no differences between SAPUI5 and SAP Web Components regarding the component’s behaviors and framework-specific patterns.