Skip to content

Dropdown Menu

Displays a menu to the user — such as a set of actions or functions — triggered by a button.

Pointer opening focuses the menu panel without highlighting an item; keyboard Enter, Space, or ArrowDown opening focuses the first enabled item. Up/Down, Home/End, typeahead, Enter/Space selection, and direction-aware submenu keys skip disabled items.

DropdownMenu is modal by default: focus stays in the open menu, document scrolling is locked, and outside activation is consumed while dismissing it. Set Modal="false" when the surrounding page must remain interactive and scrollable.

Set Loop="true" on each DropdownMenuContent or DropdownMenuSubContent that should wrap. Set Direction="Direction.Rtl" on the root for RTL key direction, and use TextValue when an item's rendered text is not a useful typeahead label.

Use DropdownMenuCheckboxItem and DropdownMenuRadioGroup for persistent choices. Their state changes before the menu closes; call PreventDefault() from OnSelecting when an options menu should remain open while a choice changes.

Root and submenu content is named by its trigger automatically unless you provide an explicit aria-label or aria-labelledby. Compose custom layouts from the menu parts rather than nesting another raw role="menu" inside DropdownMenuContent.

The normal trigger, content, item, and nested-submenu composition is progressively enhanced in true static server rendering. The browser owns opening, Floating UI positioning, roving focus, typeahead, submenu pointer grace, modal focus/scroll/pointer isolation, outside/Escape dismissal, and focus return without a Blazor circuit.

Use DropdownMenuItem Href="..." for native navigation that works with pointer and keyboard selection. For a browser-only action, listen for the cancelable shardui:dropdown-menu-select event. Its detail contains instanceId, itemId, and textValue; calling preventDefault() keeps the menu open.

DropdownMenu.OnSelect, DropdownMenuItem.OnSelect, and imperative Open()/Close()/Toggle() calls require an interactive renderer after the response. Closed content remains serialized as hidden and inert markup, so it is not a secrecy or authorization boundary.

An unhandled error has occurred. Reload 🗙

    Rejoining the server...

    Rejoin failed... trying again in seconds.

    Failed to rejoin.
    Please retry or reload the page.

    The session has been paused by the server.

    Failed to resume the session.
    Please reload the page.