Popup Menu
Popup Menu is used to create menus outside the main navigation, e.g. context menus. If used in a context where the nearest positined ancestor is in the shadow DOM (e.g. DuetCard) the popup menu may not be positioned correctly. This can be avoide by using a positioned wrapper element, e.g. div with position relative.
Examples #
Properties #
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
accessibleLabel | accessible-label | Adds accessible label for the menu that is only presented for users of assistive technologies. A popup menu should always have an accessible label that describes the popup's function. | string | undefined |
accessibleRole | accessible-role | Accessible role. | "list" | "menu" | "menu" |
controller | controller | Element controlling the opening and closing of the popup menu. | HTMLElement & FocusableComponent & OpenerComponent | string | undefined |
crossAxisOffset | cross-axis-offset | Cross axis positioning offset of the popup menu relative to its controller. For "top" and "bottom" placements cross axis is horizontal, for "left" and "right" vertical. | number | 0 |
forcePlacement | force-placement | Force placement. | boolean | false |
mainAxisOffset | main-axis-offset | Main axis positioning offset of the popup menu relative to its controller. For "top" and "bottom" placements main axis is vertical, for "left" and "right" horizontal. | number | 0 |
placement | placement | Placement of the popup menu relative to its controller. Possible values: "top", "bottom", "left" and "right", optionally combined with "-start" or "-end". | "bottom" | "bottom-end" | "bottom-start" | "left" | "left-end" | "left-start" | "right" | "right-end" | "right-start" | "top" | "top-end" | "top-start" | "bottom-start" |
position | position | Position. | "absolute" | "fixed" | "absolute" |
theme | theme | Theme. | "" | "default" | "turva" | "" |
Events #
Event | Description | Type |
---|---|---|
duetToggle | Emitted when the popup menu is opened or closed. | CustomEvent<{ open: boolean; component: "duet-popup-menu"; }> |
Methods #
hide() => Promise<void>
#
Hide.
Returns #
Type: Promise<void>
isOpen() => Promise<boolean>
#
isOpen.
Returns #
Type: Promise<boolean>
show() => Promise<void>
#
Show.
Returns #
Type: Promise<void>
toggle() => Promise<void>
#
Toggle.
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 have a menu that pops up outside the main navigation.
When not to use #
- If you are using Toolbar or Menubar.
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.
- Underlying component has
menu
role which marks the component as a menu for screen readers. - It can be navigated with keyboard.
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.
Tutorials
Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:
Building Layouts
TutorialsUsing CLI Tools
TutorialsCreating Custom Patterns
TutorialsServer Side Rendering
TutorialsSharing Prototypes
TutorialsUsage With Markdown
Troubleshooting
If you experience any issues while using a component, please head over to the Support page for more guidelines and help.