Adds a menus collection to Payload for building navigation with link, dropdown and mega menu items. Menus are identified by slug and locale and served through a public endpoint with server-side caching. Frontend helpers fetchMenu and useMenu let you consume menus outside the admin. Requires Payload 3.
A plugin for Payload CMS that provides a flexible and customisable menu system.
Installation
npm i @foundrykit/menu-plugin7
Stars
0
Forks
0
Open Issues
1 months ago
Last Updated
0
Weekly Downloads
v
npm Version
Dependencies
7+1 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 7 |
| Dec 4, 2026 | 7 |
| Dec 3, 2026 | 7 |
| Dec 2, 2026 | 7 |
| Dec 1, 2026 | 7 |
| Nov 30, 2026 | 7 |
| Nov 29, 2026 | 7 |
| Nov 28, 2026 | 7 |
| Nov 27, 2026 | 7 |
| Nov 26, 2026 | 7 |
| Nov 25, 2026 | 7 |
| Nov 24, 2026 | 7 |
| Nov 23, 2026 | 7 |
| Nov 22, 2026 | 7 |
| Nov 21, 2026 | 7 |
| Nov 20, 2026 | 7 |
| Nov 19, 2026 | 7 |
| Nov 18, 2026 | 7 |
| Nov 17, 2026 | 7 |
| Nov 16, 2026 | 7 |
| Nov 15, 2026 | 7 |
| Nov 14, 2026 | 7 |
| Nov 13, 2026 | 7 |
| Nov 12, 2026 | 7 |
| Nov 11, 2026 | 7 |
| Nov 10, 2026 | 7 |
| Nov 9, 2026 | 7 |
| Nov 8, 2026 | 7 |
| Nov 7, 2026 | 7 |
| Nov 6, 2026 | 7 |
| Nov 5, 2026 | 7 |
| Nov 4, 2026 | 7 |
| Nov 3, 2026 | 7 |
| Nov 2, 2026 | 7 |
| Nov 1, 2026 | 7 |
| Oct 31, 2026 | 7 |
| Oct 30, 2026 | 7 |
| Oct 29, 2026 | 7 |
| Oct 28, 2026 | 7 |
| Oct 27, 2026 | 7 |
| Oct 26, 2026 | 7 |
| Oct 25, 2026 | 7 |
| Oct 24, 2026 | 6 |
| Oct 23, 2026 | 6 |
| Oct 22, 2026 | 6 |
| Oct 21, 2026 | 6 |
| Oct 20, 2026 | 6 |
| Oct 19, 2026 | 6 |
| Oct 18, 2026 | 6 |
| Oct 17, 2026 | 6 |
| Oct 16, 2026 | 6 |
| Oct 15, 2026 | 6 |
| Oct 14, 2026 | 6 |
| Oct 13, 2026 | 6 |
| Oct 12, 2026 | 6 |
| Oct 11, 2026 | 6 |
| Oct 10, 2026 | 6 |
| Oct 9, 2026 | 6 |
| Oct 8, 2026 | 6 |
| Oct 7, 2026 | 6 |
| Oct 6, 2026 | 6 |
| Oct 5, 2026 | 6 |
| Oct 4, 2026 | 6 |
| Oct 3, 2026 | 6 |
| Oct 2, 2026 | 6 |
| Oct 1, 2026 | 6 |
| Sep 30, 2026 | 6 |
| Sep 29, 2026 | 6 |
| Sep 28, 2026 | 6 |
| Sep 27, 2026 | 6 |
| Sep 26, 2026 | 6 |
| Sep 25, 2026 | 6 |
| Sep 24, 2026 | 6 |
| Sep 23, 2026 | 6 |
| Sep 22, 2026 | 6 |
| Sep 21, 2026 | 6 |
| Sep 20, 2026 | 6 |
| Sep 19, 2026 | 6 |
| Sep 18, 2026 | 6 |
| Sep 17, 2026 | 6 |
| Sep 16, 2026 | 6 |
| Sep 15, 2026 | 6 |
| Sep 14, 2026 | 6 |
| Sep 13, 2026 | 6 |
| Sep 12, 2026 | 6 |
| Sep 11, 2026 | 6 |
| Sep 10, 2026 | 6 |
| Sep 9, 2026 | 6 |
| Sep 8, 2026 | 6 |
| Sep 7, 2026 | 6 |
| Sep 6, 2026 | 6 |
218+218 since Oct 22
| Date | Weekly downloads |
|---|---|
| Nov 13, 2026 | 218 |
| Nov 12, 2026 | 228 |
| Nov 11, 2026 | 172 |
| Nov 10, 2026 | 168 |
| Nov 9, 2026 | 173 |
| Nov 8, 2026 | 176 |
| Nov 7, 2026 | 145 |
| Nov 6, 2026 | 208 |
| Nov 5, 2026 | 201 |
| Nov 4, 2026 | 190 |
| Nov 3, 2026 | 417 |
| Nov 2, 2026 | 417 |
| Nov 1, 2026 | 417 |
| Oct 31, 2026 | 420 |
| Oct 30, 2026 | 349 |
| Oct 29, 2026 | 325 |
| Oct 28, 2026 | 50 |
| Oct 27, 2026 | 75 |
| Oct 26, 2026 | 75 |
| Oct 25, 2026 | 56 |
| Oct 24, 2026 | 56 |
| Oct 23, 2026 | 56 |
| Oct 22, 2026 | 0 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1155793773-root)<a href="https://payloaddirectory.dev/plugins/1155793773-root"><img src="https://payloaddirectory.dev/badge/1155793773-root.svg" alt="Payload Directory"></a>README
A Payload CMS v3 plugin that adds a configurable menu management system to the admin panel. It lets you model nested navigation, fetch menus by slug, and consume them from regular frontend code without depending on Payload admin UI context.
reveal layout) or classic
multi-column layout (columns), each with a featured panelafterRead hookGET /api/menus/:slug endpoint with locale and depth supportfetchMenu helper plus a useMenu hook built on top of itslug + localemegaColumns data to the new megaEntries
shapepnpm add @foundrykit/menu-plugin
import { buildConfig } from 'payload'
import { menuPlugin } from '@foundrykit/menu-plugin'
export default buildConfig({
plugins: [
menuPlugin({
baseUrl: 'https://example.com',
relationTo: ['pages', 'posts'],
}),
],
})
This registers a menus collection in Payload.
| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | '' | Base URL prefix shown for internal links in the admin |
cacheTTL | number | 60000 | Server cache TTL in milliseconds |
childrenDepth | number | 1 | Relationship depth used when resolving dynamic mega entry children |
disabled | boolean | false | Keep the collection schema, but disable plugin runtime endpoints, hooks, and admin helper UI |
dynamicSources | DynamicSource[] | [] | Sources used to auto-populate dynamic mega entries from related collections (see below) |
enableImportExport | boolean | true | Register the import/export endpoints |
maxDepth | number | 1 | Maximum nesting depth for dropdown items |
mediaCollection | string | undefined | Upload collection used for mega menu featured images |
relationTo | string | string[] | 'pages' | Collection(s) available for reference links |
requireAdminForImportExport | boolean | true | Require an authenticated admin user for import/export endpoints |
Example:
menuPlugin({
baseUrl: 'https://mysite.com',
cacheTTL: 300_000,
maxDepth: 3,
relationTo: ['pages', 'posts', 'products'],
})
Menus are uniquely identified by slug + locale.
slug: "main-menu", locale: "en" and slug: "main-menu", locale: "fr" can coexistEach menu item has a kind (itemType): link, dropdown, or mega. A mega item
exposes:
megaLayout: reveal (default — a flat list of rows that reveal their
children in a second panel) or columns (classic multi-column layout)defaultFeatured: a fallback featured panel (image, heading, description, CTA)megaEntries: a flat list of entries. Each entry is itself a link and can
reveal children in a secondary panel, plus an optional per-entry featured
panel whose mode is inherit (use defaultFeatured), manual, or dynamic.Featured images use the mediaCollection option as their upload relationTo.
An entry's source can be manual (children typed by hand) or dynamic
(children pulled from a related collection). Dynamic entries are resolved
server-side by an afterRead hook on the menus collection, so they work
through every read path — the /api/menus/:slug endpoint, payload.find, and
menus populated as a relationship on another global/collection — with no extra
wiring. Resolution is read-only, idempotent, locale-aware, and degrades to empty
children on misconfiguration (never throws).
Configure the available sources via dynamicSources:
import { menuPlugin, type DynamicSource } from '@foundrykit/menu-plugin'
const destinations: DynamicSource = {
name: 'destinations',
label: 'Destinations',
collection: 'destinations', // queried for children
parentCollection: 'regions', // editor picks a parent from here
parentField: 'region', // field on a child relating it to its parent
labelField: 'title', // child field used as the label
hrefBuilder: (doc) => `/destinations/${doc.slug as string}`,
sort: 'title',
limit: 0, // optional; defaults to 0 (return all)
featured: {
imageField: 'heroImage', // dot-path to an upload/media field
headingField: 'title',
descriptionField: 'excerpt',
ctaHrefBuilder: (doc) => `/destinations/${doc.slug as string}`,
ctaLabel: 'Explore',
},
}
menuPlugin({
relationTo: ['pages'],
mediaCollection: 'media',
dynamicSources: [destinations],
})
When exactly one source is configured, the entry's dynamicSource select is
hidden and auto-set, and the parent relationship collapses to that single
collection. With multiple sources, the editor chooses a source and the parent
relationship spans the union of all configured parentCollections.
megaColumns dataEarlier versions modelled mega menus as megaColumns. Convert existing data to
the new megaEntries shape with the exported helper. It is safe to run multiple
times — already-migrated documents are skipped.
import { migrateMegaColumnsToEntries } from '@foundrykit/menu-plugin'
// `payload` is an initialised Payload instance
const { migrated, scanned } = await migrateMegaColumnsToEntries(payload)
console.log(`Migrated ${migrated} of ${scanned} menus`)
GET /api/menus/:slug
Query parameters:
locale: optional locale variantdepth: Payload relationship depth, default 0Example:
curl 'https://example.com/api/menus/main-menu?locale=en&depth=1'
GET /api/menus-export
By default this requires an authenticated admin user.
POST /api/menus-import
Content-Type: application/json
Accepts either a JSON array of menu documents or { "menus": [...] }.
Imports upsert by slug + locale.
Example response:
{
"created": 1,
"updated": 2,
"errors": []
}
fetchMenuUse fetchMenu anywhere you have a fetch implementation, including server components and non-Payload frontend code.
import { fetchMenu } from '@foundrykit/menu-plugin/rsc'
const menu = await fetchMenu({
slug: 'main-menu',
locale: 'en',
depth: 1,
baseURL: 'https://example.com',
})
useMenu'use client'
import { useMenu } from '@foundrykit/menu-plugin/client'
export function Navigation() {
const { error, isLoading, menu } = useMenu({
slug: 'main-menu',
locale: 'en',
depth: 1,
baseURL: 'https://example.com',
})
if (isLoading) return <div>Loading...</div>
if (error) return <div>{error}</div>
if (!menu) return null
return <pre>{JSON.stringify(menu, null, 2)}</pre>
}
useMenu includes a 30 second client-side cache and aborts in-flight requests on unmount.
slug, locale, and depthcacheTTLMIT
payload nav studio
Replaces the Payload admin sidebar with a drag and drop navigation that each user can customize
66108/wk15v3
payload plugin menus
Manage navigation menus from the Payload admin and render them in a frontend
5440/wk0v2
payload navigation
Drag-and-drop navigation menu builder with a precomputed clean item tree for frontend use
42151/wk2v3
payload nested docs page tree
Page tree list view for nested docs collections with drag and drop, status badges and live or preview links
771.6k/wk35v3
payload enhanced sidebar
Tabbed sidebar navigation for the Payload admin that groups collections, globals and custom links
76835/wk32v3 v4
payload plugin menu
Editor-friendly navigation menus with dropdowns, headings, icons and per-entry visibility
76126/wk0v3