Components
← All components

Overflow Menu

stimeo--overflow-menu

Moves toolbar items that no longer fit into a More dropdown (lowest priority first) and back as space returns.

  • Menu Button

The stimeo--overflow-menu controller keeps a toolbar's items within their container width: it watches the container with a ResizeObserver and, on each debounced change, measures the items and banks the lowest-priority ones into a More dropdown until the rest fit beside the button, moving them back as space returns. Priority is read from data-priority (lower is kept longer; items without one drop first), and items are moved — not cloned — so a focused item that retreats keeps focus. The menu's accessibility is delegated to Menu: banked items get role="menuitem", tabindex="-1", and the menu's item target, with any authored role / tabindex saved and restored on the way back. When nothing overflows the More button is hidden. The controller element carries data-overflowing and data-overflow-count, and a change event fires on each transition. Behavior only — no styling. State is derived from the DOM each pass (no module-scope state), so connect re-syncs after a Turbo morph; the ResizeObserver and debounce timer are released on disconnect (Turbo navigation included). Call the update action to re-measure after adding items dynamically.

running