Adds click-to-edit to Payload live preview. Clicking a block or field in the preview scrolls the admin form to it, expands it and focuses it, and links to other pages open that document in the admin. The admin side is a plugin configured per collection, while a framework-agnostic script and helpers run on the preview page. Requires Payload 3, Next.js 15 or later and React 19 in the admin; currently alpha.
Click a block or field in the Payload live preview to open it in the edit form. A free, framework-agnostic click-to-edit for Payload 3.
Installation
npm i payload-preview-click0
Stars
0
Forks
0
Open Issues
4 weeks ago
Last Updated
7
Weekly Downloads
v0.1.0-alpha.1
npm Version
62.0 KB
Unpacked Size
0
Dependencies
00 since Nov 1
| Date | Stars |
|---|---|
| Dec 6, 2026 | 0 |
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
| Nov 7, 2026 | 0 |
| Nov 6, 2026 | 0 |
| Nov 5, 2026 | 0 |
| Nov 4, 2026 | 0 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
| Nov 1, 2026 | 0 |
7+7 since Nov 9
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 7 |
| Dec 5, 2026 | 5 |
| Dec 4, 2026 | 12 |
| Dec 3, 2026 | 13 |
| Dec 2, 2026 | 14 |
| Dec 1, 2026 | 19 |
| Nov 30, 2026 | 19 |
| Nov 29, 2026 | 18 |
| Nov 28, 2026 | 21 |
| Nov 27, 2026 | 15 |
| Nov 26, 2026 | 16 |
| Nov 25, 2026 | 17 |
| Nov 24, 2026 | 15 |
| Nov 23, 2026 | 16 |
| Nov 22, 2026 | 19 |
| Nov 21, 2026 | 20 |
| Nov 20, 2026 | 21 |
| Nov 19, 2026 | 27 |
| Nov 18, 2026 | 36 |
| Nov 17, 2026 | 44 |
| Nov 16, 2026 | 348 |
| Nov 15, 2026 | 345 |
| Nov 14, 2026 | 341 |
| Nov 13, 2026 | 338 |
| Nov 12, 2026 | 330 |
| Nov 11, 2026 | 318 |
| Nov 10, 2026 | 307 |
| Nov 9, 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/1448834127-root)<a href="https://payloaddirectory.dev/plugins/1448834127-root"><img src="https://payloaddirectory.dev/badge/1448834127-root.svg" alt="Payload Directory"></a>README
English · Français
Click a block or a field in the Payload live preview: the edit form scrolls to it, expands it and focuses it. Click a link to another page: that page opens in the admin.
Alpha. The API may change before 1.0.
A free, MIT-licensed alternative to part of Payload's Visual Editor (Enterprise). It does not edit in place: it takes editors to the right spot in the regular form. Not affiliated with Payload.
pnpm add payload-preview-click
Requires Payload 3, Next.js ≥ 15 and React 19 on the admin side. The preview side has no dependencies.
// payload.config.ts
import { previewClickPlugin } from 'payload-preview-click'
export default buildConfig({
plugins: [
previewClickPlugin({ collections: { pages: 'layout' } }), // collection → its blocks field
],
})
Then run pnpm payload generate:importmap. Live preview must be set up for the collection
(admin.livePreview.url).
Mark the blocks: a comment before each block, and one after the last.
import { blockMarker, BLOCKS_END } from 'payload-preview-click/preview'
blockMarker(3, 'faq') // '<!--preview-block:3:faq-->', 3 = row of the block
Or, in React and similar, attributes on the block's root: blockAttributes(isPreview, index, blockType).
Mark the fields: paths relative to the block, array rows by index. Outside the preview, nothing is added.
import { editable } from 'payload-preview-click/preview'
const edit = editable(isPreview) // or Astro.locals, with a `preview` flag
edit('title') // { 'data-preview-field': 'title' }
edit(`items.${i}.question`) // { 'data-preview-field': 'items.2.question' }
Run the script, on the preview page only:
import { initPreviewClick, pageLinks, pageResolver } from 'payload-preview-click/preview'
initPreviewClick({
cmsOrigin: 'https://cms.example.com', // messages are posted to this origin only
path: 'layout', // same blocks field as in the plugin
current: { collection: 'pages', id: 4, locale: 'en' },
// Optional: which links open which document. Without it, links are blocked.
resolvePage: pageResolver({
collection: 'pages',
links: pageLinks([{ id: 4, paths: { en: '/about/', fr: '/fr/a-propos/' } }]),
}),
})
Other options: labels (texts shown to the editor), color, keepState. Without a bundler, load
payload-preview-click/preview.global.js and call window.PayloadPreviewClick.initPreviewClick().
Set Astro.locals.preview = true in the preview route, then:
---
// RenderBlocks.astro
import { blockMarker, BLOCKS_END } from 'payload-preview-click/preview'
const preview = !!Astro.locals.preview
---
{Astro.props.blocks.map((block, i) => (
<>{preview && <Fragment set:html={blockMarker(i, block.blockType)} />}<Block block={block} /></>
))}
{preview && <Fragment set:html={BLOCKS_END} />}
---
// Faq.astro
import { editable } from 'payload-preview-click/preview'
const edit = editable(Astro.locals)
---
<h2 {...edit('title')}>{Astro.props.block.title}</h2>
<!-- PreviewHead.astro, in <head> on the preview only -->
<script>
import { initPreviewClick } from 'payload-preview-click/preview'
initPreviewClick({ cmsOrigin: import.meta.env.PUBLIC_CMS_URL, path: 'layout' })
</script>
In the preview, the first click selects a block, each next click goes one level down (array row, then field), and Escape goes back up. Each selection is posted to the admin:
{ type: 'payload-preview-click', path: 'layout', index: 3, field?: 'items.2.question' }
{ type: 'payload-preview-navigate', collection: 'pages', id: 4, locale?: 'fr' }
Links do not leave the preview: a link to a known page opens it in the admin (⌘/Ctrl + click inside a block), other links and forms are blocked.
cmsOrigin.no-store and noindex.@payloadcms/ui hooks; tested with Payload 3.93 and Next 16.pnpm install && pnpm test && pnpm build
To try it in a Next.js app, install it with file:../payload-preview-click, not link: (Turbopack does not
follow symlinks outside the project root).
payload better editor
Side-by-side live-preview iframe with a sidebar for editing individual blocks in the Payload edit view
781.2k/wk119v3
payload plugin html preview
Live preview and click-to-edit in the Payload admin for any frontend that renders HTML, no framework needed
74451/wk37v3
payload inplace
Live inline editing for Payload-powered Next.js websites with block reordering and reviewed drafts
62175/wk6v3
plugin
Click-to-edit inline visual editing and block operations on top of Payload Live Preview
581.3k/wk13v3
payload better preview
Live preview with block hover highlighting and two-way scroll sync between the Payload admin and the preview
4846/wk16v3
plugin
On-page editing and draft preview links for Payload collections and globals on a Next.js frontend
6068/wk4v3 v4