Dropdown

A menu that floats under its trigger.

It flips above the trigger when there's no room below. A click outside, picking an item, Escape, or opening another menu closes it.

Installation

bash
shellui-native add dropdown

Platforms: MAUI · Avalonia. Also installs dropdown-trigger, dropdown-content, dropdown-item, element-extensions, icon.

Usage

Basic

Rendered with ShellUI for Blazor
<ui:Dropdown>
    <ui:DropdownTrigger>
        <ui:Button Text="Shewart" Icon="ChevronDown" IconPosition="Right" Variant="Outline" />
    </ui:DropdownTrigger>
    <ui:DropdownContent>
        <ui:DropdownItem Text="Profile" Icon="User" Clicked="OnProfile" />
        <ui:DropdownItem Text="Settings" Icon="Settings" Clicked="OnSettings" />
        <ui:DropdownItem Text="Log out" Icon="LogOut" Clicked="OnLogOut" />
    </ui:DropdownContent>
</ui:Dropdown>
Avalonia, running in your browser

MAUI and Avalonia

MAUI also keeps ToggleAsync() and CloseAsync() for older code; on Avalonia use Toggle() and Close().

API

XAML children go to Items on Avalonia.

Property Type Default Description
IsOpen bool false Whether it's open. Two-way bindable.
Event Arguments Description
IsOpenChanged bool Opened or closed.
Method Description
ToggleAsync() Kept for compatibility with earlier versions. MAUI only.
CloseAsync() MAUI only.
SetOpen(bool value) Opens or closes it.
Toggle() Opens it if closed, closes it if open.
Close() Closes it.
Method Description
Activate() Does what pressing it does.
ShellTriggerView.ActivateAncestor(Element from) Called by interactive children (Button) after they handle a click.

XAML children go to Items on Avalonia and Children on MAUI.

No properties of its own.

Property Type Default Description
Text string — Text shown by the component.
Icon IconName None Lucide icon from IconName; None for no icon.
Event Arguments Description
Clicked — Clicked or tapped (or Enter / Space with keyboard focus).
Method Description
Press() Picks the item in code, as a click or Enter/Space would. Avalonia only.

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 retry or reload the page.