Skip to main content

Popup Menu Item

Popup Menu Item is used to add items to menus created with Popup Menu

Open in new window
<duet-button size="small" id="menu-toggle">toggle menu</duet-button>
<duet-popup-menu accessibleLabel="Sample action menu" id="sample-menu">
<duet-popup-menu-item leading-icon="category-pet">Some Action</duet-popup-menu-item>
<duet-popup-menu-item>Another Action With a Much Longer Label</duet-popup-menu-item>
<duet-popup-menu-item active trailing-icon="messaging-success">Active Action</duet-popup-menu-item>
<duet-popup-menu-item url="#" trailing-text="⌘ A">Actually a link</duet-popup-menu-item>
</duet-popup-menu>

<script>
document.getElementById('menu-toggle').addEventListener('click', function(evt) {
const menu = document.getElementById('sample-menu');
menu.controller = evt.target;
menu.toggle();
});
</script>

Properties #

Property Attribute Description Type Default
accessibleLabel accessible-label Adds accessible label for the button or link that is only shown for screen readers. Typically, this label text replaces the visible text on the button for users who use assistive technology. string undefined
accessibleRole accessible-role Accessible role. "listitem" | "menuitem" "menuitem"
active active Is the item currently active (e.g. selected) boolean false
external external Forces URL to open in a new browser tab. Used together with URL prop. boolean false
leadingIcon leading-icon Left icon. string undefined
leadingIconColor leading-icon-color Left icon color. string undefined
targetLanguage target-language Language of the link. Use this only for language selection links. "en" | "fi" | "sv" undefined
theme theme Theme. "" | "default" | "turva" ""
trailingIcon trailing-icon Right icon. string undefined
trailingText trailing-text Short text to display after the label, e.g. keyboard shortcut. string undefined
url url A destination to link to, rendered in the href attribute of a link. string undefined
value value Value string undefined

Events #

Event Description Type
duetBlur Emitted when the item loses focus. CustomEvent<{ originalEvent?: Event; value: string; component: "duet-popup-menu-item"; }>
duetFocus Emitted when the item receives focus. CustomEvent<{ originalEvent?: Event; value: string; component: "duet-popup-menu-item"; }>

Methods #

isFocused() => Promise<boolean> #

isFocused.

Returns #

Type: Promise<boolean>

setFocus(options?: FocusOptions) => Promise<void> #

Sets focus. Use this method instead of the global focus().

Parameters #

Name Type Description
options FocusOptions

Returns #

Type: Promise<void>


Usage #

This section includes guidelines for designers and developers about the usage of this component in different contexts.

When to use #

  • When you want to add items to a Popup Menu.

When not to use #

  • If you are not using Popup Menu.

Accessibility #

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.


Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.

Integration guidelines


Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.