rock-solid

payload solid admin bar

by rock-solid
payload-solid-admin-bar
Admin customization
v3
^3.90.0
MIT

Overview

Summary generated from the README

Adds a dark admin bar across the top of every Payload admin screen and, for logged-in editors, across the website. It offers a site link, View or Edit for the current document, a New menu limited to collections the user may create, exit preview, and log out. It is configured through a plugin plus a website component, and requires Payload 3 and React 19.

Features

  • Admin bar in the admin header and on the website via a React component
  • View page link on published document edit screens using per-collection path functions
  • New menu listing only collections the user is allowed to create
  • Exit preview button for draft mode on the website
  • Multi-tenant support that shows the tenant and sets the tenant cookie when creating documents
  • Stylesheet customizable through CSS custom properties; hidden inside Live Preview frames by default

Use cases

  • Give editors quick edit, view and create links while browsing the live Next.js site
  • Switch between the website and admin dashboard without hunting for URLs
  • Show the current tenant and create tenant-scoped documents in multi-tenant sites

From the author

A WordPress-style admin bar for Payload CMS, the same in the admin and on the website: visit site, edit or view the current document, create new documents, exit preview and log out

Installation

npm i @rocksoliddigital/payload-solid-admin-bar

0

Stars

0

Forks

1

Open Issues

1 weeks ago

Last Updated

96

Weekly Downloads

v0.3.0

npm Version

45.6 KB

Unpacked Size

0

Dependencies

GitHub stars

00 since Nov 22

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20260
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
npm weekly downloads

179+179 since Nov 25

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 2026179
Dec 5, 2026392
Dec 4, 2026429
Dec 3, 2026872
Dec 2, 2026864
Dec 1, 2026854
Nov 30, 2026832
Nov 29, 2026742
Nov 28, 2026507
Nov 27, 2026453
Nov 26, 20260
Nov 25, 20260

Each point is npm's rolling 7-day download count.

Health Score

65/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1469557557-payload-solid-admin-bar.svg)](https://payloaddirectory.dev/plugins/1469557557-payload-solid-admin-bar)
HTML
<a href="https://payloaddirectory.dev/plugins/1469557557-payload-solid-admin-bar"><img src="https://payloaddirectory.dev/badge/1469557557-payload-solid-admin-bar.svg" alt="Payload Directory"></a>
Updated Nov 26, 2026Created Nov 24, 2026Published Nov 26, 2026

README

@rocksoliddigital/payload-solid-admin-bar

npm

A WordPress-style admin bar for Payload CMS. The same dark strip shows across the top of every admin screen and, for logged-in editors, across the top of the website:

In the adminOn the website
SiteSite name → the website (new tab)Site name → the admin dashboard
CurrentView page on a published document's screenEdit page for the document shown
Create+ New → the collections the user may createsame
Preview—Exit preview in draft mode
UserEmail → account, Log outsame

Payload's own @payloadcms/admin-bar covers only the website side, for one collection.

Demo

A small Payload + Next.js site shows it in the admin, on the website and in Live Preview: see the repo.

Install

pnpm add @rocksoliddigital/payload-solid-admin-bar

It needs Payload 3 and React 19.

Admin

// payload.config.ts
import { adminBarPlugin } from '@rocksoliddigital/payload-solid-admin-bar/plugin';

plugins: [
  adminBarPlugin({
    siteName: 'Example',
    // Leave siteURL out when the site and the admin share an origin; set it, or
    // ({ req, payload }) => tenant domain, when the website lives elsewhere
    collections: {
      pages: { path: ({ doc }) => (doc.slug === 'home' ? '/' : `/${doc.slug}`) },
      posts: { path: ({ doc }) => `/posts/${doc.slug}` },
      categories: { create: false },
    },
  }),
];

Then run payload generate:importmap, and import the stylesheet in app/(payload)/layout.tsx. The bar goes in admin.components.header, so it sits above Payload's own header and scrolls away with it (Payload has many position: sticky elements that a fixed bar would cover).

  • View appears on a document's edit screen when its collection has a path and the document is published. The document is read as the logged-in user (overrideAccess: false).
  • + New lists the collections in collections, minus create: false and those the user may not create.
  • siteURL: leave it out when the website and the admin share an origin, so the links stay relative and follow whatever domain the editor is on (preview deploys included). A fixed URL sends every environment to that domain. It may be a function of the request: a multi-tenant site can return the selected tenant's domain. Defaults to the config's serverURL.

Website

// a client wrapper in the site's layout, so it can pass onPreviewExit
'use client';
import { AdminBar } from '@rocksoliddigital/payload-solid-admin-bar/site';

<AdminBar
  siteName="Example"
  collections={{ pages: { label: 'Page' }, posts: { label: 'Post' } }}
  preview={draftModeEnabled}
  onPreviewExit={() => fetch('/next/exit-preview').then(() => router.refresh())}
/>;
// the site's root layout, once
import '@rocksoliddigital/payload-solid-admin-bar/styles.css';
// in each page: which document it shows, for the Edit link
import { AdminBarDocument } from '@rocksoliddigital/payload-solid-admin-bar/site';

<AdminBarDocument collection="pages" id={page.id} />;

The bar asks the CMS who is logged in (/api/<users>/me, then /api/access) from the browser, so pages stay static and visitors get nothing. For a CMS on another origin, pass cmsURL and allow the site in Payload's cors and csrf. Custom routes: admin, api, account, logout, userCollection.

Live Preview: inside a frame, such as the admin's Live Preview pane, the bar renders nothing and makes no requests, since the admin around it already has one. Pass showInFrames to show it anyway.

Multi-tenancy

With Payload's multi-tenant plugin, the bar names the tenant on screen (a location, a brand, a site) and keeps "+ New" in it.

// payload.config.ts
adminBarPlugin<Location>({
  siteName: 'Example',
  collections: {
    // `tenant` is the document's tenant, read once by the bar
    pages: { path: ({ doc, tenant }) => `/${tenant?.slug}/${doc.slug}` },
  },
  tenants: {
    collection: 'locations', // the plugin's tenantsSlug
    path: ({ tenant }) => `/${tenant.slug}`, // its home page; leave out for no link
  },
});
  • In the admin, the bar shows the document's tenant on its edit screen, and the tenant selected in the admin elsewhere, linking to its home page. Its name is the tenants collection's useAsTitle field, or tenants.label(tenant). Options: field (the tenant field, default tenant) and cookie (the selected tenant's cookie, default payload-tenant). path can return a full URL when each tenant has its own domain.

  • On the website, tell the bar the page's tenant:

    <AdminBarDocument
      collection="pages"
      id={page.id}
      tenant={{ id: location.id, label: location.name, href: `/${location.slug}` }}
    />
    

    The bar shows its name, and "+ New" sets the multi-tenant plugin's cookie to it, so a page created from a location's website starts in that location, whatever was selected in the admin. That needs the CMS on the site's origin; tenantCookie names the cookie, or false leaves it alone. A page without an AdminBarDocument (a listing, say) shows no tenant.

  • Tenants on their own domains with one CMS: the website bar asks the CMS who is logged in from the tenant's domain. Browsers send Payload's login cookie (SameSite=Lax) only between sites on the same registrable domain (cms.example.com and harbour.example.com), so on separate domains the website bar can't see the login and stays hidden. The admin bar works either way.

Styling

Import the stylesheet once in each root layout that shows the bar: the website's and Payload's app/(payload)/layout.tsx.

import '@rocksoliddigital/payload-solid-admin-bar/styles.css';

The components don't import it themselves, so they also load in plain Node (integration tests, scripts). Override the custom properties on .solid-admin-bar (--solid-admin-bar-bg, -fg, -hover-bg, -accent, -height). Bar (from /site) is the markup alone, for stories and custom wrappers.

Not yet

  • Globals (View/Edit for a global).

Similar plugins