Skip to main content

Dropdown

shadow

Dropdown element is used to display the context menu after clicking the button. Allows the user to select one of the predefined options. It contains a Button element that acts as an activator and a Menu element with content in the form of individual MenuItem. items.

Basic usage

This example shows a basic dropdown with a trigger and menu content. It is a good starting point for common action or navigation menus.

This example uses a dropdown item to trigger a follow-up action, specifically opening a dialog.

Display on hover

This example switches the dropdown from click-based opening to hover so the behavior difference is easy to compare.

This example shows how the wje-dropdown component can work together with a tooltip for additional context.

This example uses an avatar as the dropdown trigger, which is a common pattern for profile menus and user actions.

When to use

Use wje-dropdown to communicate status, result of actions, or required next steps immediately.

When not to use

Do not show multiple feedback channels for the same event unless there is a strong reason.

Accessibility

Announce status updates with suitable ARIA live regions and manage focus for modal interactions.

Best Practices

  • Match message severity (info/success/warning/error) to actual user impact.
  • Use confirmations only for destructive or hard-to-reverse actions.
  • Keep timeouts consistent so users have enough time to read messages.

Attributes and Properties

active

DescriptionControls whether the dropdown is currently open.
Attributeactive
Typeboolean
Default-

portaled

DescriptionSets or removes the 'portaled' attribute on the element. When the value is truthy, the attribute 'portaled' is added to the element. When the value is falsy, the attribute 'portaled' is removed from the element.
Attributeportaled
Typeboolean
Default-

trigger

DescriptionSets the text value stored in trigger.
Attributetrigger
Typestring|string
Defaultclick

Events

NameDescription
wje-dropdown:openEvent fired when the dropdown is opened.
wje-dropdown:closeEvent fired when the dropdown is closed.

Methods

No public methods available for this component.

CSS Shadow Parts

NameDescription
nativeThe native part of the dropdown.

CSS Custom Properties

No CSS custom properties available for this component.

Slots

NameDescription
triggerThe slot for the trigger of the dropdown.
defaultThe default slot for the dropdown.