Adds a presets collection and a Save as preset action on every block, plus a blocks drawer that lists saved presets for one-click application. Blocks are auto-discovered, so no block or collection changes are needed. It requires Payload 3.90 or later and the companion guard plugin, with access to the presets collection defined in a project access policy file.
Presets plugin for Payload CMS - save and apply reusable block configurations
Installation
npm i @focus-reactive/payload-plugin-presets37
Stars
5
Forks
33
Open Issues
Today
Last Updated
5.3k
Weekly Downloads
v1.0.1
npm Version
271.2 KB
Unpacked Size
2
Dependencies
37+22 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 37 |
| Dec 5, 2026 | 37 |
| Dec 4, 2026 | 37 |
| Dec 3, 2026 | 37 |
| Dec 2, 2026 | 37 |
| Dec 1, 2026 | 36 |
| Nov 30, 2026 | 35 |
| Nov 29, 2026 | 35 |
| Nov 28, 2026 | 34 |
| Nov 27, 2026 | 34 |
| Nov 26, 2026 | 34 |
| Nov 25, 2026 | 34 |
| Nov 24, 2026 | 34 |
| Nov 23, 2026 | 34 |
| Nov 22, 2026 | 34 |
| Nov 21, 2026 | 34 |
| Nov 20, 2026 | 33 |
| Nov 19, 2026 | 32 |
| Nov 18, 2026 | 32 |
| Nov 17, 2026 | 32 |
| Nov 16, 2026 | 32 |
| Nov 15, 2026 | 32 |
| Nov 14, 2026 | 32 |
| Nov 13, 2026 | 32 |
| Nov 12, 2026 | 32 |
| Nov 11, 2026 | 32 |
| Nov 10, 2026 | 32 |
| Nov 9, 2026 | 31 |
| Nov 8, 2026 | 31 |
| Nov 7, 2026 | 31 |
| Nov 6, 2026 | 31 |
| Nov 5, 2026 | 31 |
| Nov 4, 2026 | 30 |
| Nov 3, 2026 | 30 |
| Nov 2, 2026 | 30 |
| Nov 1, 2026 | 30 |
| Oct 31, 2026 | 30 |
| Oct 30, 2026 | 30 |
| Oct 29, 2026 | 30 |
| Oct 28, 2026 | 30 |
| Oct 27, 2026 | 30 |
| Oct 26, 2026 | 30 |
| Oct 25, 2026 | 30 |
| Oct 24, 2026 | 29 |
| Oct 23, 2026 | 29 |
| Oct 22, 2026 | 29 |
| Oct 21, 2026 | 29 |
| Oct 20, 2026 | 29 |
| Oct 19, 2026 | 29 |
| Oct 18, 2026 | 29 |
| Oct 17, 2026 | 27 |
| Oct 16, 2026 | 26 |
| Oct 15, 2026 | 26 |
| Oct 14, 2026 | 26 |
| Oct 13, 2026 | 25 |
| Oct 12, 2026 | 25 |
| Oct 11, 2026 | 25 |
| Oct 10, 2026 | 25 |
| Oct 9, 2026 | 25 |
| Oct 8, 2026 | 25 |
| Oct 7, 2026 | 25 |
| Oct 6, 2026 | 24 |
| Oct 5, 2026 | 24 |
| Oct 4, 2026 | 24 |
| Oct 3, 2026 | 23 |
| Oct 2, 2026 | 22 |
| Oct 1, 2026 | 22 |
| Sep 30, 2026 | 20 |
| Sep 29, 2026 | 20 |
| Sep 28, 2026 | 20 |
| Sep 27, 2026 | 20 |
| Sep 26, 2026 | 19 |
| Sep 25, 2026 | 18 |
| Sep 24, 2026 | 18 |
| Sep 23, 2026 | 18 |
| Sep 22, 2026 | 18 |
| Sep 21, 2026 | 18 |
| Sep 20, 2026 | 18 |
| Sep 19, 2026 | 18 |
| Sep 18, 2026 | 18 |
| Sep 17, 2026 | 18 |
| Sep 16, 2026 | 18 |
| Sep 15, 2026 | 18 |
| Sep 14, 2026 | 18 |
| Sep 13, 2026 | 17 |
| Sep 12, 2026 | 17 |
| Sep 11, 2026 | 17 |
| Sep 10, 2026 | 16 |
| Sep 9, 2026 | 16 |
| Sep 8, 2026 | 16 |
| Sep 7, 2026 | 15 |
Shared by 15 plugins in focusreactive/payload-plugins.
5.3K+4.7K since Sep 7
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 5,299 |
| Dec 5, 2026 | 4,550 |
| Dec 4, 2026 | 4,228 |
| Dec 3, 2026 | 2,975 |
| Dec 2, 2026 | 2,264 |
| Dec 1, 2026 | 2,199 |
| Nov 30, 2026 | 2,190 |
| Nov 29, 2026 | 1,686 |
| Nov 28, 2026 | 4,475 |
| Nov 27, 2026 | 4,728 |
| Nov 26, 2026 | 6,984 |
| Nov 25, 2026 | 9,607 |
| Nov 24, 2026 | 10,154 |
| Nov 23, 2026 | 12,127 |
| Nov 22, 2026 | 14,228 |
| Nov 21, 2026 | 14,008 |
| Nov 20, 2026 | 14,242 |
| Nov 19, 2026 | 11,812 |
| Nov 18, 2026 | 9,568 |
| Nov 17, 2026 | 9,210 |
| Nov 16, 2026 | 7,238 |
| Nov 15, 2026 | 6,346 |
| Nov 14, 2026 | 4,209 |
| Nov 13, 2026 | 5,429 |
| Nov 12, 2026 | 8,405 |
| Nov 11, 2026 | 11,046 |
| Nov 10, 2026 | 15,271 |
| Nov 9, 2026 | 19,390 |
| Nov 8, 2026 | 20,315 |
| Nov 7, 2026 | 20,660 |
| Nov 6, 2026 | 20,099 |
| Nov 5, 2026 | 17,456 |
| Nov 4, 2026 | 14,775 |
| Nov 3, 2026 | 10,379 |
| Nov 2, 2026 | 6,571 |
| Nov 1, 2026 | 8,008 |
| Oct 31, 2026 | 8,234 |
| Oct 30, 2026 | 7,495 |
| Oct 29, 2026 | 6,518 |
| Oct 28, 2026 | 6,001 |
| Oct 27, 2026 | 8,761 |
| Oct 26, 2026 | 12,465 |
| Oct 25, 2026 | 11,715 |
| Oct 24, 2026 | 11,444 |
| Oct 23, 2026 | 10,663 |
| Oct 22, 2026 | 11,261 |
| Oct 21, 2026 | 11,999 |
| Oct 20, 2026 | 9,219 |
| Oct 19, 2026 | 5,217 |
| Oct 18, 2026 | 3,135 |
| Oct 17, 2026 | 2,644 |
| Oct 16, 2026 | 3,443 |
| Oct 15, 2026 | 3,529 |
| Oct 14, 2026 | 4,766 |
| Oct 13, 2026 | 4,893 |
| Oct 12, 2026 | 5,607 |
| Oct 11, 2026 | 5,634 |
| Oct 10, 2026 | 6,956 |
| Oct 9, 2026 | 8,076 |
| Oct 8, 2026 | 10,908 |
| Oct 7, 2026 | 10,541 |
| Oct 6, 2026 | 10,688 |
| Oct 5, 2026 | 10,458 |
| Oct 4, 2026 | 9,957 |
| Oct 3, 2026 | 8,679 |
| Oct 2, 2026 | 6,796 |
| Oct 1, 2026 | 3,357 |
| Sep 30, 2026 | 1,827 |
| Sep 29, 2026 | 1,568 |
| Sep 28, 2026 | 1,034 |
| Sep 27, 2026 | 1,013 |
| Sep 26, 2026 | 1,078 |
| Sep 25, 2026 | 3,346 |
| Sep 24, 2026 | 4,538 |
| Sep 23, 2026 | 6,945 |
| Sep 22, 2026 | 8,503 |
| Sep 21, 2026 | 9,632 |
| Sep 20, 2026 | 10,540 |
| Sep 19, 2026 | 10,401 |
| Sep 18, 2026 | 8,177 |
| Sep 17, 2026 | 7,055 |
| Sep 16, 2026 | 4,725 |
| Sep 15, 2026 | 3,230 |
| Sep 14, 2026 | 2,138 |
| Sep 13, 2026 | 938 |
| Sep 12, 2026 | 627 |
| Sep 11, 2026 | 720 |
| Sep 10, 2026 | 705 |
| Sep 9, 2026 | 650 |
| Sep 8, 2026 | 590 |
| Sep 7, 2026 | 554 |
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/1177993877-payload-plugin-presets)<a href="https://payloaddirectory.dev/plugins/1177993877-payload-plugin-presets"><img src="https://payloaddirectory.dev/badge/1177993877-payload-plugin-presets.svg" alt="Payload Directory"></a>README
A plugin for Payload CMS that enables saving and applying reusable block presets in the admin panel.
Copy and paste this prompt into your AI assistant (Cursor, Claude, etc.) to add the plugin to an existing Payload project.
I want reusable block presets in my Payload CMS v3 admin with
@focus-reactive/payload-plugin-presets. Follow these steps in order, and stop to ask me where a step says so.
## Rules you must follow
- Never write an access rule that admits every logged-in user: no `Boolean(req.user)`, no `() => true`,
no `({ req }) => !!req.user`. A rule names a role, or it is `nobody`.
- Do not invent roles. Ask me who may use, save and delete presets.
- Write every policy entry by hand in `src/access.policy.ts`, and grant each capability and each
collection right explicitly to the roles I name. Nothing is open by default.
- When the boot or a request fails, fix the cause or ask me. Never use `anyone`, a looser gate,
`overrideAccess` or a removed or disabled check to make an error go away.
- Do not add `overrideAccess: true` anywhere, and do not pass `overrides.access` to the plugin.
## How the plugin works
The plugin adds a `presets` collection that stores one block's field values per preset, a "Save as preset"
action on every block, and a blocks drawer that offers the saved presets. Editors save, apply, rename and
delete presets through Payload's own REST API for that collection, so the collection's access in the
project's access policy decides who may do what. The plugin has no capabilities of its own; its policy
entry under `plugins` is empty.
## Step 1: install
pnpm add @focus-reactive/payload-plugin-presets @focus-reactive/payload-plugin-guard
Check that `payload` is 3.90 or later; if it is not, upgrade it first.
## Step 2: ask me about roles
Look at the auth collection named in `admin.user` and the roles it has.
Ask me: "Which roles may see and apply presets?", "Which roles may save and rename presets?" and
"Which roles may delete presets?"
Wait for my answers. Write each answer as a gate in the policy file in step 3.
## Step 3: the access policy file
Open `src/access.policy.ts`, or create it if the project has none, following the guard README
(`defineAccessPolicy`, `gate`, `filter`, `nobody`, `anyone`, checked with `satisfies AccessPolicy<Config>`).
If you create it, every collection and global of the config needs an entry: move each existing
`access` of the project into the file, and ask me for every rule you cannot read from the code.
Add these entries for this plugin:
collections: {
presets: {
read: <the gate from my first answer>,
create: <the gate from my second answer>,
update: <the gate from my second answer>,
delete: <the gate from my third answer>,
},
},
plugins: {
"presets-plugin": {},
},
## Step 4: register the plugin and wrap the config
// payload.config.ts
import { buildConfig } from 'payload'
import { withAccessPolicy } from '@focus-reactive/payload-plugin-guard'
import { presetsPlugin } from '@focus-reactive/payload-plugin-presets'
import { accessPolicy } from './access.policy'
export default withAccessPolicy(
accessPolicy,
buildConfig({
// ...the existing config
plugins: [
presetsPlugin({ access: accessPolicy.plugins['presets-plugin'] }),
],
})
)
Run `pnpm payload generate:importmap` and `pnpm payload generate:types`, and with a SQL adapter create and run a migration.
## Step 5: verify, and show me the output
With the app running, send each request and show me the status code.
Every one of them must be refused. If one succeeds, the policy is wrong: stop and tell me.
1. Anonymous preset creation, expect 403:
curl -i -X POST http://localhost:3000/api/presets -H 'Content-Type: application/json' -d '{"name":"x","presetBlock":[]}'
2. The same request with the session cookie of a user whose role may not save presets, expect 403.
3. DELETE /api/presets/<id> with the session cookie of a user whose role may not delete presets, expect 403.
Then, as a user who may save presets, use "Save as preset" on a block and check that the preset appears in the blocks drawer.
pnpm add @focus-reactive/payload-plugin-presets @focus-reactive/payload-plugin-guard
Payload 3.90 or later is required.
The plugin is built on @focus-reactive/payload-plugin-guard.
Who may see, save and delete presets is written in the project's access policy file, as the access of the presets collection.
// src/access.policy.ts, the entries for this plugin
collections: {
presets: { read: isStaff, create: isEditor, update: isEditor, delete: isEditor },
},
plugins: {
"presets-plugin": {},
},
// payload.config.ts
import { withAccessPolicy } from "@focus-reactive/payload-plugin-guard";
import { presetsPlugin } from "@focus-reactive/payload-plugin-presets";
import { accessPolicy } from "./access.policy";
export default withAccessPolicy(
accessPolicy,
buildConfig({
plugins: [presetsPlugin({ access: accessPolicy.plugins["presets-plugin"] })],
})
);
isStaff and isEditor stand for gates on your own roles; the guard README shows how to write them.
npx payload generate:importmap
# or: pnpm payload generate:importmap / bunx payload generate:importmap
npx payload migrate:create create_presets
npx payload migrate
Skip if you use the MongoDB adapter.
presetsPlugin({
// Optional: override label or fields for specific block types
presetTypes: [
{
slug: "hero", // must match block.slug exactly
label: { en: "Hero", es: "Hero" }, // optional, falls back to block.labels.singular
fields: heroPresetFields, // optional, falls back to block.fields
},
],
// Optional: defaults shown
slug: "presets",
labels: {
singular: { en: "Preset", es: "Preset" },
plural: { en: "Presets", es: "Presets" },
},
mediaCollection: "media",
enabled: true,
// Required: the plugin's entry in your access policy
access: accessPolicy.plugins["presets-plugin"],
// Optional: collection overrides; access comes from the policy
overrides: {
fields: (defaultFields) => [...defaultFields, customField],
hooks: {
beforeChange: [myHook],
},
admin: {
defaultColumns: ["name", "type", "updatedAt"],
},
},
});
presetsPlugin(options)Main plugin function. access is required; the other options are optional.
| Option | Type | Default | Description |
|---|---|---|---|
access | {} | required | accessPolicy.plugins["presets-plugin"] from your access policy |
presetTypes | PresetType[] | [] | Per-block overrides for label and fields - both fall back automatically |
slug | string | 'presets' | Collection slug for presets |
labels | object | - | Collection labels |
enabled | boolean | true | Enable/disable plugin |
packageName | string | '@focus-reactive/payload-plugin-presets' | Override for component resolution (set to local path for dev without npm) |
mediaCollection | string | 'media' | Media collection for preview images |
overrides | object | - | Collection overrides (fields, hooks, admin) |
PresetTypeinterface PresetType {
slug: string; // Block slug to target - must match block.slug exactly
label?: string | { en: string; es?: string }; // Falls back to block.labels.singular or slug
fields?: Field[]; // Falls back to block.fields automatically
}
The plugin declares no capabilities: saving, applying, renaming and deleting presets are plain reads and writes of the presets collection, made with the user's own rights.
The collection's entry in the access policy decides who may do each of them.
read: who sees presets in the blocks drawer and in the collection.create and update: who saves and renames presets. "Save as preset" and the create button of the preset picker are shown only to a user with create, and the edit button of a preset in the blocks drawer only to a user with update.delete: who deletes presets from the drawer or the collection. The delete button of a preset in the blocks drawer is shown only to a user with delete, and a delete the server refuses is reported in a toast.Applying a preset changes only the form of the document being edited; saving that document needs the user's own update right on it.
The collection is created through the guard, so it takes no access from the plugin or from overrides, and the boot fails while the policy has no entry for it.
access is a required option; pass accessPolicy.plugins["presets-plugin"], which is an empty object.
| Slug | Kind | Written by | Read by |
|---|---|---|---|
presets (or slug) | collection | your policy's create, update and delete | your policy's read |
With enabled: false the collection is left out, and so is its policy entry.
The plugin includes built-in translations for English and Spanish. Keys are under presetsPlugin:
presetsPlugin.presetActions.* - Save preset modalpresetsPlugin.applyPreset.* - Apply preset messagespresetsPlugin.blocksDrawer.* - Blocks drawer labelsid, blockType, blockName, experiment) when saving presets1.0 moves the plugin onto @focus-reactive/payload-plugin-guard; Upgrading to the guard explains the model all the plugins share, with a complete example.
Every access rule is now written by hand in your project's src/access.policy.ts, and nothing is open by default: an entry you leave out stops the boot, and a capability you do not grant is refused for everyone.
@payloadcms/* package 3.90 or later, with the React and Next versions Payload 3.90 requires, Node 22.22 or later, and @focus-reactive/payload-plugin-guard installed next to the plugin.access is a required option; the plugin declares no capabilities, so it is the empty presets-plugin entry of the policy.overrides.access is refused at boot: the rules move into the policy entry for the presets collection.
In 0.x a project that left overrides.access out let every logged-in user of any auth collection read, save and delete presets.Upgrade payload and every @payloadcms/* package to 3.90 or later, run the server on Node 22.22 or later, and install the guard:
pnpm add @focus-reactive/payload-plugin-guard @focus-reactive/payload-plugin-presets.
Add the plugin's entries to src/access.policy.ts, with gates for your own roles; if the project has no policy file yet, write it first as the guide describes.
// src/access.policy.ts, inside defineAccessPolicy({ ... })
collections: {
presets: { create: isEditor, read: panelUser, update: isEditor, delete: isEditor },
},
plugins: {
"presets-plugin": {},
},
presets (or the slug in slug): read decides who sees presets in the blocks drawer, create and update who saves and renames them, delete who deletes them.Pass access: accessPolicy.plugins["presets-plugin"] to presetsPlugin, and export the config wrapped: export default withAccessPolicy(accessPolicy, buildConfig({ ... })).
Database: no migration; the presets collection keeps its columns.
Re-test: an anonymous GET /api/presets answers 403, and a user of another auth collection or without create cannot save a preset; then save, apply, rename and delete a preset as an editor.
MIT
Topics
Tags
payload plugin stacked editing
Stacked, breadcrumb-navigated editing panels for nested blocks and arrays in the Payload admin
71250/wk37v3
payload plugin visual editing
Click-to-edit overlays on your frontend that focus the matching field in the Payload admin
741.4k/wk37v3
payload plugin scheduling
Schedule future publication of drafts on collections and globals with a secured cron endpoint
77783/wk37v3
payload plugin comments
Document-level and field-level comments with mentions, resolution and email notifications for Payload admin
757.0k/wk37v3
payload plugin ab
A/B testing with page variants managed in the Payload admin and routed by Next.js middleware at the edge
741.0k/wk37v3
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