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​

The sample shows a basic dropdown with the trigger and menu contents. It's a good starting point for a normal action or navigation menu.

Mobile bottom sheet​

The sample switches the dropdown to a mobile presentation with mobile-presentation="bottom-sheet" and mobile-break-point. The backdrop and sheet panel can be styled with CSS custom properties directly on the dropdown usage. On mobile, the content is portaled outside the original layout so it is not clipped by containers with overflow: hidden. The backdrop is available through the exported backdrop part and the panel through popup-native.

Nested dropdown in the dialog​

The demo uses a dropdown as the place from where the user opens a dialog with another dropdown. Clicking on an item in a nested dropdown closes only the inner dropdown and leaves the parent dropdown open.

Display on hover​

The sample switches the dropdown from a click to a hover to see both the difference in behavior and the appropriateness of this pattern.

This sample shows how to use the wje-dropdown component together with a tooltip to add a short context.

The demo uses an avatar as a dropdown trigger, which is a typical pattern for profile menus and user actions.

When to use​

Use wje-dropdown when you need to immediately communicate the status, result of an action, or next step to the user.

When not to use​

Don't use multiple competing feedback channels at the same time for one event.

Accessibility​

Communicate message status through appropriate ARIA live regions and manage focus (open/close) for modal elements.

  • Select the severity of the messages (info/success/warning/error) according to the real impact on the user.
  • For blocking actions, prefer confirmation only where irreversible change is imminent.
  • Set consistent timeouts so the user has time to read the message.

Attributes and properties​

active​

PopisUrčuje, či je rozbaľovacie menu otvorené.
Atribútactive
Typboolean
Predvolené-

mobileBreakPoint​

PopisNastavuje textovú hodnotu uloženú vo voľbe mobile-break-point.
Atribútmobile-break-point
Typstring
Predvolené768

mobilePresentation​

PopisNastavuje textovú hodnotu uloženú vo voľbe mobile-presentation.
Atribútmobile-presentation
Typstring
Predvolené-

portaled​

PopisUrčuje, či je voľba portaled zapnutá a ovplyvňuje správanie komponentu.
Atribútportaled
Typboolean
Predvolené-

trigger​

PopisNastavuje textovú hodnotu uloženú vo voľbe trigger.
Atribúttrigger
Typstring|string
Predvolenéclick

Events​

NázovPopis
wje-dropdown:openVyvolá sa pri otvorení komponentu.
wje-dropdown:closeVyvolá sa pri zatvorení komponentu.

Methods​

syncPopupOwner​

PopisSynchronizuje popup owner s externým alebo interným zdrojom stavu.
Signatúra() => void

syncOwnedContentOwner​

PopisSynchronizuje owned content owner s externým alebo interným zdrojom stavu.
Signatúra(root?: HTMLElement) => void

getMenuItemOwner​

PopisVráti menu položku owner z aktuálneho stavu komponentu.
Signatúra(path: EventTarget[], item: HTMLElement) => HTMLElement|null

CSS shadow parts​

NázovPopis
nativeŠtýluje koreňovú shadow časť komponentu.
popup-nativeŠtýluje shadow časť popup-native.
backdropŠtýluje shadow časť backdrop.

CSS custom variables​

NázovPopis
--wje-popup-backdrop-backgroundVlastná CSS premenná na štýlovanie komponentu (popup backdrop background).
--wje-popup-backdrop-opacityVlastná CSS premenná, ktorá riadi úroveň priehľadnosti.
--wje-popup-mobile-backgroundVlastná CSS premenná na štýlovanie komponentu (popup mobile background).
--wje-popup-mobile-border-radiusVlastná CSS premenná, ktorá riadi zaoblenie rohov.
--wje-popup-mobile-box-shadowVlastná CSS premenná, ktorá riadi tieň.
--wje-popup-mobile-max-heightVlastná CSS premenná, ktorá riadi popup mobile max height.
--wje-popup-mobile-transition-durationVlastná CSS premenná, ktorá riadi časovanie animácie a prechodov.
--wje-popup-mobile-transition-easingVlastná CSS premenná, ktorá riadi časovanie animácie a prechodov.

Slots​

NázovPopis
triggerSlot pre obsah spúšťača.
defaultPredvolený slot pre hlavný obsah komponentu.