1yakub

payload live nav

by 1yakub
Publishing workflow
v3
^3.0.0
MIT

Overview

Summary generated from the README

Adds a collapsible section index to configured edit views so one click scrolls both the form and the Live Preview to the same section. Focusing a field in the form scrolls the previewed page to the element tagged with a matching data-cms-field attribute and flashes it. A small listener component or function must be added to the previewed page, and the admin and the preview must share an origin. Requires Payload 3.

Features

  • Collapsible page index panel listing configured sections per collection or global
  • Click a section to jump the edit form and the preview iframe together
  • Focus a field to scroll the preview to its element and flash it
  • React listener component plus a framework-agnostic attach function for the frontend
  • Group paths resolve through the first child element, and unmatched child paths fall back to their parent
  • Falls back to matching group heading text through an admin label option

Use cases

  • Navigate long landing pages by jumping the form and preview to the same section
  • Help editors find which part of the rendered page a form field controls
  • Speed up content entry on pages with many grouped sections

From the author

Section index and field to preview focus bridge for the Payload admin: click a section to jump both the form and the Live Preview, focus a field to flash it on the page.

Installation

npm i payload-live-nav

0

Stars

0

Forks

0

Open Issues

3 months ago

Last Updated

15

Weekly Downloads

v0.1.1

npm Version

34.7 KB

Unpacked Size

0

Dependencies

GitHub stars

00 since Sep 7

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
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
Nov 7, 20260
Nov 6, 20260
Nov 5, 20260
Nov 4, 20260
Nov 3, 20260
Nov 2, 20260
Nov 1, 20260
Oct 31, 20260
Oct 30, 20260
Oct 29, 20260
Oct 28, 20260
Oct 27, 20260
Oct 26, 20260
Oct 25, 20260
Oct 24, 20260
Oct 23, 20260
Oct 22, 20260
Oct 21, 20260
Oct 20, 20260
Oct 19, 20260
Oct 18, 20260
Oct 17, 20260
Oct 16, 20260
Oct 15, 20260
Oct 14, 20260
Oct 13, 20260
Oct 12, 20260
Oct 11, 20260
Oct 10, 20260
Oct 9, 20260
Oct 8, 20260
Oct 7, 20260
Oct 6, 20260
Oct 5, 20260
Oct 4, 20260
Oct 3, 20260
Oct 2, 20260
Oct 1, 20260
Sep 30, 20260
Sep 29, 20260
Sep 28, 20260
Sep 27, 20260
Sep 26, 20260
Sep 25, 20260
Sep 24, 20260
Sep 23, 20260
Sep 22, 20260
Sep 21, 20260
Sep 20, 20260
Sep 19, 20260
Sep 18, 20260
Sep 17, 20260
Sep 16, 20260
Sep 15, 20260
Sep 14, 20260
Sep 13, 20260
Sep 12, 20260
Sep 11, 20260
Sep 10, 20260
Sep 9, 20260
Sep 8, 20260
Sep 7, 20260
npm weekly downloads

15+8 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 202615
Dec 5, 202610
Dec 4, 202610
Dec 3, 20264
Dec 2, 20262
Dec 1, 20265
Nov 30, 20265
Nov 29, 20264
Nov 28, 20264
Nov 27, 20265
Nov 26, 20265
Nov 25, 20266
Nov 24, 20263
Nov 23, 20263
Nov 22, 20265
Nov 21, 20265
Nov 20, 20264
Nov 19, 20266
Nov 18, 20266
Nov 17, 20266
Nov 16, 20269
Nov 15, 20268
Nov 14, 202611
Nov 13, 202612
Nov 12, 202613
Nov 11, 202613
Nov 10, 202615
Nov 9, 202612
Nov 8, 202612
Nov 7, 202611
Nov 6, 20269
Nov 5, 20267
Nov 4, 20266
Nov 3, 20265
Nov 2, 20267
Nov 1, 20269
Oct 31, 20268
Oct 30, 20268
Oct 29, 20267
Oct 28, 20267
Oct 27, 20267
Oct 26, 20268
Oct 25, 20267
Oct 24, 20268
Oct 23, 20268
Oct 22, 202615
Oct 21, 202617
Oct 20, 202616
Oct 19, 202615
Oct 18, 202614
Oct 17, 202613
Oct 16, 202613
Oct 15, 202610
Oct 14, 20268
Oct 13, 20269
Oct 12, 20269
Oct 11, 20269
Oct 10, 20268
Oct 9, 202610
Oct 8, 20267
Oct 7, 20267
Oct 6, 20268
Oct 5, 20266
Oct 4, 20267
Oct 3, 20269
Oct 2, 20269
Oct 1, 20268
Sep 30, 20269
Sep 29, 20268
Sep 28, 20268
Sep 27, 20267
Sep 26, 20268
Sep 25, 20266
Sep 24, 20267
Sep 23, 20267
Sep 22, 20268
Sep 21, 20269
Sep 20, 20269
Sep 19, 20268
Sep 18, 20269
Sep 17, 202610
Sep 16, 202616
Sep 15, 202615
Sep 14, 202616
Sep 13, 202616
Sep 12, 202614
Sep 11, 202613
Sep 10, 202612
Sep 9, 20266
Sep 8, 20265
Sep 7, 20267

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

Health Score

54/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/1327533310-root.svg)](https://payloaddirectory.dev/plugins/1327533310-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1327533310-root"><img src="https://payloaddirectory.dev/badge/1327533310-root.svg" alt="Payload Directory"></a>
Updated Aug 8, 2026Created Aug 8, 2026Published Aug 8, 2026

README

payload-live-nav

CI npm version license Payload 3

Section navigation for the Payload admin, wired to Live Preview. Click a section in a small index panel and both the edit form and the preview jump there. Focus any field and the preview scrolls to that element and flashes it.

payload-live-nav demo: live typing, section jumps and the focus flash in the Payload admin

Payload's Live Preview shows you the page while you edit, but on a long page you still scroll the form and the preview separately, hunting for the field you want. This closes that gap.

What you get

  • Focus bridge. Focus a field in the edit form and the previewed page scrolls to the element carrying that field's data-cms-field attribute, with a short flash so your eye lands on it. Zero config, works on every edit view with Live Preview.
  • Page index. A collapsible rail on the edit views you configure, listing the page's sections. One click scrolls the form to that group and sends the preview to the same section.

Install

pnpm add payload-live-nav

Setup

1. Register the plugin in payload.config.ts. The entities map is keyed by collection or global slug; each listed entity gets the page index on its edit view.

import { liveNavPlugin } from 'payload-live-nav'

export default buildConfig({
  plugins: [
    liveNavPlugin({
      entities: {
        homepage: {
          sections: [
            { label: 'Hero', path: 'hero', adminLabel: 'Hero (top of page)' },
            { label: 'FAQ', path: 'faq' },
          ],
        },
      },
    }),
  ],
})

path is the section group's field path in the form. adminLabel is the group's label as the admin renders it; it defaults to label and only matters for the fallback described below.

2. Drop the listener into the previewed page. React (Next.js layout or page):

import { LiveNavListener } from 'payload-live-nav/frontend'

// anywhere in the previewed page tree, renders nothing
<LiveNavListener />

Not on React? The core is framework agnostic:

import { attachLiveNavListener } from 'payload-live-nav/frontend'

const detach = attachLiveNavListener(document)

3. Tag your elements. Give the rendered elements a data-cms-field attribute matching their field path:

<h1 data-cms-field="hero.headline">{hero.headline}</h1>

A group path like faq needs no element of its own: the listener resolves it through the first child it finds (faq.headline), and unmatched child paths climb to their parent.

How it works, and what it depends on

The admin side watches focusin events and reads Payload's internal field-<path> DOM id scheme to learn which field you are in, then posts the path into the Live Preview iframe with postMessage (same origin only, both directions). That id scheme is internal to Payload: if a future version changes it, this plugin degrades to a quiet no-op rather than breaking your admin, and the page index falls back to matching the group's heading text (that is what adminLabel is for).

Three edge cases this plugin carries fixes for, learned in production:

  1. Smooth scrolling dies on re-render. Closing the index panel re-renders the document and Chrome cancels in-flight smooth scrolls. Form jumps are instant; only the iframe, its own document, scrolls smooth.
  2. The admin form scrolls via the body, and body.getBoundingClientRect().top goes negative once scrolled. Root scrolling therefore uses the viewport relative offset directly instead of container relative math, which double counts.
  3. Payload lazy renders form content after long jumps, shifting the layout right after landing. The jump re-measures and re-corrects at 250ms and 650ms; the taps are instant and imperceptible.

Compatibility

PayloadStatus
3.85tested
4.xuntested, internals may differ

Same origin setups only: the admin and the previewed site must share an origin, which is Payload's default Live Preview arrangement.

License

MIT

Similar plugins