Components / Library Version 5.12.0
Action Menu
This component provides a dropdown menu of action items. When closed, it displays a text-only button, icon-only button, or a selector box. Selecting a menuitem completes the associated action and closes the menu. It should have at least one wm-menuitem component as a child.
After an action is executed make sure to properly handle focus for keyboard users.
** Required in certain cases
Properties of the parent element wm-action-menu
icon | text | selector | selector-primary icon.
Properties for each Action Menu type:
stringtext or selector action menu.
Required when button-type is text or
selector.
stringicon action menu.
Required when button-type is icon. It should indicate the
name or purpose of the menu.
booleanbooleanselector menu can be disabled as a whole (rather than just individual menuitems).
string
If a page has several
icon action menus with an identical tooltips, the aria-label of
the button needs to include more descriptive information than the tooltip displayed. In that case, set this prop
to the more descriptive name, and leave the tooltip prop unchanged.
top | bottom | left | right | top-left | top-right | bottom-left | bottom-right
left. If there is not enough space to display the
tooltip at the indicated position, the component will automatically reposition it.
Properties of the children elements wm-menuitem
stringicon property.
stringbutton-type is set to icononly. Accepts the
following formats to reference different icon sources.
- The name of a commonly-used icon listed on our Icons guidelines. Value must begin with ”#”. For example,
#add-person - A local file path pointing to an svg symbol. For example:
"/icons/icons.svg#pencil" - A Material Design Icon character code. For example:
"f3eb". (Deprecated)
Learn more on adding SVGs in our Component Usage section. See the complete list of character codes on the Material Design Icon CDN. Opens a new window
Usage in HTML
Edit the code below to see changes reflected in the example above.
Usage in Elm
Code generated from HTML.
General
The "tooltip" property required for icon action menus ensures that the name or purpose of the menu is apparent on hover and announced by screenreaders.
Keyboard Support
Menu Button
| Key | Function |
|---|---|
| Down Arrow Space Enter | Opens menu and moves focus to first menuitem. |
| Down Arrow Space Enter | Opens menu and moves focus to last menuitem. |
Menu
| Key | Function |
|---|---|
| Enter |
|
| Escape |
|
| Up Arrow |
|
| Down Arrow |
|
| Home | Moves focus to the first menuitem. |
| End | Moves focus to the last menuitem. |
| A-Z a-z |
|
- When a menuitem is clicked, an attribute is temporarily added to the body. The attribute is used to reapply focus when a new menu is loaded with updated menuitems.
- Depending on context, screen readers may not announce the expanded state. This is normal behavior and does not constitutes an accessibility issue.