# Menu Components ## Menu Behavior (Auth, User, and Mobile) All menu components implement consistent behavior for opening and closing using pure Livewire functionality: 1. **Click Outside to Close** - Uses `wire:click.away="close"` to close menu when clicking outside - Calls the Livewire `close()` method directly 2. **Toggle on Button Click** - Uses `wire:click.stop="toggle"` on the trigger button/image - Prevents event bubbling with wire:click.stop - Toggle method directly flips the boolean state - Simple and efficient state management 3. **Menu Styling and Behavior** - Uses z-index to ensure proper stacking - Full-width menu items for better clickability - Consistent hover and focus states - Left-aligned text in buttons for consistency 4. **Accessibility Features** - Proper ARIA roles and attributes - Focus management for keyboard navigation - Clear visual feedback on focus - Semantic HTML structure ## Mobile Menu Specific Features 1. **Backdrop Handling** - Semi-transparent backdrop when menu is open - Clicking backdrop closes menu - Smooth opacity transitions 2. **Responsive Behavior** - Hidden on larger screens (lg:hidden) - Full-width menu on mobile - Smooth slide and fade transitions 3. **Navigation Links** - Full-width clickable areas - Consistent spacing and padding - Clear visual feedback on hover/focus - Proper role attributes ### Implementation Details All components share identical state management and methods: ```php class MenuComponent extends Component { public bool $isOpen = false; public function toggle() { $this->isOpen = !$this->isOpen; } public function close() { $this->isOpen = false; } } ``` Menu buttons include proper accessibility attributes: ```blade ``` Menu containers have proper ARIA roles: ```blade