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.
Checkbox and radio items
dropdown_checkbox turns a setting on or off; dropdown_radio picks one of several. Both keep the menu open between clicks. Pass checked from your assigns and handle phx-click. Checkbox items send their new state as checked.
- Update billing details Nov 9
- Review the dropdown PR Nov 12
- Clear the support backlog Nov 14
- Write release notes Nov 18
- Book a venue for the offsite Nov 27
Form integration
Bind items to a form field with dropdown_checkbox_group, dropdown_radio_group, or a field on dropdown_checkbox. A click updates the item instantly and runs the form's phx-change. label adds a group header; deselectable lets a second click clear the selected radio.
Selectable items
Set indicator={false} to replace the radio circle with your own mark, and show it on the selected item with in-data-checked:. close_on_select closes the menu once a choice is made.
Custom indicators
With indicator={false}, draw any mark you like: a trailing check, a dot, bold text, or an icon that lights up. Style the selected item with data-checked: and its contents with in-data-checked:.
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
Group options with dropdown_checkbox_group for multi-select and dropdown_radio_group for single-select. Each label renders a header for its group.
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
A filter panel inside a form, with one submenu per facet. Each change updates a draft through phx-change, so the counts on the triggers stay current. Apply submits and closes the panel, Reset clears every item with Fluxon.clear_dropdown/1, and on_close discards changes that were never applied.
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.