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.

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é-

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.

CSS custom variables

Pre tento komponent nie sú dostupné žiadne vlastné CSS vlastnosti.

Slots

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