feat(panels): support grouped user menu items with separate dropdown …#19863
Open
tomjamon wants to merge 2 commits into
Open
feat(panels): support grouped user menu items with separate dropdown …#19863tomjamon wants to merge 2 commits into
tomjamon wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Panels currently only support a single flat
userMenuItems()array. Items below the theme switcher all appear in one<x-filament::dropdown.list>, which makes dense menus (e.g. account + locales + support) hard to scan.This PR adds an optional grouped registration shape: pass a list of arrays, where each inner array is one registration group. When more than one group exists, the panel renders multiple
<x-filament::dropdown.list>blocks after the theme switcher (same hooks and item rendering as today).Backward compatibility
userMenuItems([...])call behaves exactly as before.userMenuItems([...])calls still merge new items into the last group (existing pattern preserved).Logout
If no group defines
logout, the default logout action is appended to the last after-theme group so users always keep a sign-out entry.Implementation note
getUserMenuItems()is memoized per request on the panel so profile/logout and other resolved actions are the same instances whether the menu is built as a flat list or split into groups. That keeps Livewire’sdefaultView(Action::GROUPED_VIEW)andcacheAction()aligned with what Blade renders (avoids a secondgetUserLogoutMenuItem()instance rendering as a primary button).Visual changes
Before: One continuous list under the theme switcher for all
sort() >= 0items.After (when using grouped registration): Visually separated lists—one per registered group—still using the same dropdown list item styling.
Functional changes
composer cscommand.