Dropdown
Action menu anchored to a trigger, with submenus and keyboard navigation.
Basic
Links and buttons
dropdown_link renders a Phoenix <.link> for navigation; dropdown_button renders a <button> for actions. Both participate in keyboard navigation.
With icons
Add class="icon" on icon elements; the menu item layout sizes and aligns them automatically.
Sections
Group related items with dropdown_header labels and dropdown_separator dividers. Headers and separators are skipped by keyboard navigation.
Disabled items
Anchors don't accept the native disabled, so disable a dropdown_link with data-disabled. Use disabled on dropdown_button.
Trailing accessories
The menu item layout reserves a third column for content that flows after the label. Drop in shortcuts, counts, or badges.
Destructive action
Pair text-danger with phx-confirm for delete-style items. The browser confirms before the click event fires.
Open on hover
open_on_hover opens the menu when the cursor enters the toggle. Pair with hover_open_delay and hover_close_delay to add intent buffers.
Placement
placement picks the side and alignment relative to the toggle. Floating UI flips and shifts the panel to keep it inside the viewport.
Menu height
The menu panel is capped at max-h-[500px] and shrinks to fit the space available, only opening on the other side once that space gets too small. Pass another max-h-* through class to change the cap, or max-h-none to fill the space on whichever side it opens.
Custom toggle
Pass any markup as the :toggle slot. Workspace switchers, profile chips, or filter pills all map onto this pattern. The wrapper carries the menu's ARIA wiring; the inner element is yours.
Footer action
Anchor a primary call-to-action at the bottom of a menu with a final dropdown_custom. Fits permission, sharing, or upgrade CTAs.
Selectable items
Toggle data-active client-side with JS.set_attribute and JS.remove_attribute while you push the change to the server. The check icon flips immediately, so the menu feels optimistic even before the round trip completes.
Inline toggles
Use dropdown_custom to embed switches alongside menu items. Custom rows are skipped by arrow-key navigation but their controls remain reachable through Tab.
Filter menu
Multi-select with checkbox and single-select with radio, grouped by dropdown_header. Each option is a <label> wrapped in dropdown_custom so the full row toggles the input.
Submenu
Pair dropdown_submenu_trigger with a sibling :submenu slot whose id matches. The submenu panel renders as a sibling of the root, so it cannot be clipped by parent overflow.
Nested submenus
Submenus can contain their own dropdown_submenu_trigger items, opening yet another panel. Each level closes independently with ArrowLeft.
Account menu
Compose a custom toggle, a dropdown_custom user card, sectioned links, and a destructive sign-out into one menu.
Filter with submenus
Submenus composed with a custom header, leading icons, count badges, and a Reset/Apply footer for a layered filter pattern.
Row action menu
Compact ellipsis trigger inside a list row, placement="bottom-end" so the panel aligns with the row's edge. The standard pattern for table-cell actions.