Repository navigation
feat(admin): no way to control the order of nav groups in the sidebar #18173
dvnold
started this conversation in
Feature Requests & Ideas
Replies: 2 comments
|
Converted this to a discussion as it's a feature request, but yes we should support this in v4! |
0 replies
|
Hi @dvnold, it looks like #17098 was closed by accident, and this has since been confirmed for v4 in the reply above. Are you planning to reopen it, or to open a new PR against v4 If you'd rather not, I have an implementation of the same If you're not taking it, I'll open it and credit your proposal. Either way is fine with me; I just don't want to step on your work. (I'm using AI assistance (Claude Code); the tests were run locally.) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Describe the Bug / Feature Gap
The admin sidebar renders nav groups in first-encounter order, determined by the order collections/globals are declared in
payload.config.tsplus the seed array ingroupNavItems. There is no config option to control the order of the groups themselves.This means:
SystemorLayoutto appear first.Layout) is forced to the bottom because all collections are iterated before all globals.Reproduction
Minimal config:
Resulting sidebar order:
There is no way to make
SystemorLayoutappear at the top without prefix hacks (group: '1. System') that leak the digit into the rendered label, or swapping in a fully customNavcomponent.Root Cause
packages/ui/src/utilities/groupNavItems.tsseeds the reducer with[Collections, Globals]and appends custom groups in first-encounter order. No sort step, noorder/weight/indexfield on collections or globals, and noadmin.groups/admin.sortGroupson the top-level admin config.Related
admin.sortGroupsbut never implemented.tatsuyaykari1203/payload-sidebarsolves it externally.Suggested API
Add an optional
admin.groupsarray to the sanitized config that lets users declare group labels in the order they should render. Groups not listed fall back to first-encounter order, preserving backward compatibility.Happy to open a PR for this — the change is small (a sort step in
groupNavItemskeyed offconfig.admin.groups).All reactions