{{-- An M3 Expressive menu: a list of actions that opens from a trigger. The trigger's first button or link becomes the menu button (aria-haspopup, aria-expanded, aria-controls). The list is a `popover="auto"` in the top layer, placed by CSS anchor positioning at `position` (`bottom-start`, `bottom-end`, `top-start`, `top-end`) and flipping when there is no room; a click outside or Escape closes it. The keyboard is WAI-ARIA's menu button: Enter, Space or ArrowDown open on the first item, ArrowUp on the last; arrows, Home, End and typing a letter move between items; Tab closes; activating an item closes the menu unless the item says `keep-open`, and Escape returns focus to the trigger. The container is Expressive's standard menu (surface-container-low, 16px corner, elevation 2), or `vibrant` in tertiary-container — StandardMenuTokens and VibrantMenuTokens from androidx Compose Material 3 (Apache-2.0). --}} @props([ 'label' => null, 'position' => 'bottom-start', 'vibrant' => false, ]) @php $position = in_array($position, ['bottom-start', 'bottom-end', 'top-start', 'top-end'], true) ? $position : 'bottom-start'; $key = \Illuminate\Support\Str::lower(\Illuminate\Support\Str::random(10)); $anchor = "--material-menu-{$key}"; @endphp
class('relative inline-flex') }}> {{ $trigger }}