Skip to content

feat(panels): support grouped user menu items with separate dropdown …#19863

Open
tomjamon wants to merge 2 commits into
filamentphp:4.xfrom
tomjamon:4.x
Open

feat(panels): support grouped user menu items with separate dropdown …#19863
tomjamon wants to merge 2 commits into
filamentphp:4.xfrom
tomjamon:4.x

Conversation

@tomjamon

Copy link
Copy Markdown
Contributor

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

  • A single flat userMenuItems([...]) call behaves exactly as before.
  • Multiple flat 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’s defaultView(Action::GROUPED_VIEW) and cacheAction() aligned with what Blade renders (avoids a second getUserLogoutMenuItem() instance rendering as a primary button).

Visual changes

Before: One continuous list under the theme switcher for all sort() >= 0 items.

Screenshot 2026-05-14 at 23 34 07

After (when using grouped registration): Visually separated lists—one per registered group—still using the same dropdown list item styling.

Screenshot 2026-05-14 at 23 34 32

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@danharrin danharrin added this to the v4 milestone May 20, 2026
@danharrin danharrin added enhancement New feature or request pending review labels May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending review

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants