Skip to content

feat(admin): no way to control the order of nav groups in the sidebar #17097

Description

@devinoldenburg

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:

  1. 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.
  2. Custom groups appear in declaration order, which fights against logical file organization.
  3. 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:

  1. Collections → banana
  2. Animals → zebra
  3. Food → apple
  4. System → settings
  5. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions