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.ts plus the seed array in groupNavItems. There is no config option to control the order of the groups themselves.
This means:
- The implicit Collections group is always forced to the top (it's seeded first in the reducer), even if the user wants a custom group like
System or Layout to appear first.
- Custom groups appear in declaration order, which fights against logical file organization.
- A globals-only group (e.g.
Layout) is forced to the bottom because all collections are iterated before all globals.
Reproduction
Minimal config:
// payload.config.ts
collections: [
{ slug: 'zebra', admin: { group: 'Animals' } },
{ slug: 'apple', admin: { group: 'Food' } },
{ slug: 'settings', admin: { group: 'System' } },
{ slug: 'banana' }, // no group -> default Collections
],
globals: [
{ slug: 'header', admin: { group: 'Layout' } },
]
Resulting sidebar order:
- Collections → banana
- Animals → zebra
- Food → apple
- System → settings
- Layout → header
There is no way to make System or Layout appear at the top without prefix hacks (group: '1. System') that leak the digit into the rendered label, or swapping in a fully custom Nav component.
Root Cause
packages/ui/src/utilities/groupNavItems.ts seeds the reducer with [Collections, Globals] and appends custom groups in first-encounter order. No sort step, no order/weight/index field on collections or globals, and no admin.groups / admin.sortGroups on the top-level admin config.
Related
Suggested API
Add an optional admin.groups array 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.
admin: {
groups: ['System', 'Animals', 'Food', 'Layout', 'Collections'],
}
Happy to open a PR for this — the change is small (a sort step in groupNavItems keyed off config.admin.groups).
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).