Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-dropdown-menu>

@methane-ui/ui~12.3 KB brotli (cold + Lit)~4.4 KB marginal

Anchored dropdown menu coordinating <mth-menu-item> children via roving focus, typeahead, dual-path positioning, and top-layer popover overlay.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Interactive StageLive Custom Element · <mth-dropdown-menu> (@methane-ui/ui)
ActionsEdit SpecDuplicateArchive
Ready · interact with <mth-dropdown-menu>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/dropdown-menu"></script>
<mth-dropdown-menu placement="bottom-start" offset="6">Example</mth-dropdown-menu>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
openopenbooleanfalseControls open visibility of the dropdown menu.
placementplacementstring"bottom-start"Preferred placement relative to trigger.
offsetoffsetnumber6Pixel distance between trigger and menu surface.
labellabelstring""Accessible label for the menu container.
closeOnSelectclose-on-selectbooleantrueCloses the menu automatically after selecting a normal/radio item.
roleModerole-mode'menu' | 'listbox'"menu"Switches internal container semantics between menu (default) and listbox.
forceFallbackforce-fallbackbooleanfalseForces JS positioning and non-top-layer fallback mode.
anchor—Element | { getBoundingClientRect(): DOMRect } | DOMRect | nullnullOptional explicit Element, VirtualAnchor, or DOMRect positioning target.

Events

EventDetail TypeDescription
mth-openvoidCancelable event fired before opening the menu.
mth-after-openvoidFired after opening completes.
mth-close{ reason: string }Cancelable event fired before closing the menu.
mth-after-close{ reason: string }Fired after closing completes and focus restores.
mth-select{ value: string; checked: boolean }Fired when a menu item is activated with { value, checked }.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowDownbothopenmoves active menu item down (wrapping at end)
ArrowUpbothopenmoves active menu item up (wrapping at start)
Homebothopenfocuses first enabled menu item
Endbothopenfocuses last enabled menu item
Enterbothopen and active item existsselects active item and emits mth-select
Escapebothopencloses menu and restores focus to trigger

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 6 APG keyboard transitions across LTR/RTL.mth-dropdown-menu.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(open).Conformance suite
i18nRoutes 1 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test