OGE logoOGE

Drop Down Button

<oge-drop-down-button> pairs an oge-button trigger with an anchored menu panel from @oge-ui/overlay — flip-aware positioning, outside-click and Escape closing, focus restore and the full WAI-ARIA menu-button keyboard pattern (arrows, Home/End, type-ahead). Items can load lazily from a promise; split mode adds an independent action button.

items splitButton rememberLastAction [(opened)] dropdownPlacement

Items & menu basics

Pass an items array of menu entries — plain actions, separators, checkable state (checked) and destructive styling (severity: 'danger'). The panel positions itself with flip-aware math, repositions on scroll, closes on outside click or Escape, and restores focus to the trigger. itemClick delivers the chosen item, then the panel closes.

items array separator checked danger severity
—

Split button & remembered action

splitButton separates the control into an action button and a chevron toggle — the main button emits clicked (with full action/clickGuard support) without opening the menu. Add rememberLastAction and the last chosen item becomes the main button's label and action for the session; selectionChanged reports each swap with the previous item.

splitButton rememberLastAction action pipeline
runs ×0 · last: — — pick a target; the main button remembers it.

Async items

Instead of an array, items accepts a function returning a promise. It is invoked on the first open — the panel shows a localized loading row, then the items; failures show an error row and the next open retries. Results are cached until the function reference changes, and stale responses from superseded requests are discarded.

async items loading row cache + retry
1.2s load on first open — subsequent opens hit the cache.

Custom panel content

For panels that are not menus — filter forms, pickers, mini toolbars — project a template with *ogeDropDownContent. It replaces the item list entirely and receives a close function as the implicit template variable, so any element inside can dismiss the panel and hand focus back to the trigger.

*ogeDropDownContent dropdownWidth close fn

Notes

  • Non-split mode: the trigger click only toggles the panel; bind (itemClick). (clicked) fires solely from the split main button.
  • The panel flips above the trigger near the viewport bottom and repositions on scroll/resize — never detaches like a frozen popup.
  • Keyboard: ↓/↑ opens focusing first/last item, type-ahead jumps by label, Esc closes and restores focus.
  • holdToConfirm/autoRepeat are not available on drop-down buttons.