npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@focus-reactive/payload-plugin-presets

v0.10.3

Published

Presets plugin for Payload CMS - save and apply reusable block configurations

Readme

@focus-reactive/payload-plugin-presets

A plugin for Payload CMS that enables saving and applying reusable block presets in the admin panel.

Features

  • Save block configurations as reusable presets
  • Apply presets to blocks with one click
  • Preview images for presets in admin panel
  • Custom blocks drawer with preset selection
  • Auto-discovers blocks — no block or collection modifications needed
  • Multi-language support (EN/ES)

Installation

pnpm add @focus-reactive/payload-plugin-presets
# or
npm install @focus-reactive/payload-plugin-presets

Usage

1. Register the Plugin

// payload.config.ts
import { presetsPlugin } from "@focus-reactive/payload-plugin-presets";

export default buildConfig({
  plugins: [presetsPlugin()],
});

The plugin auto-discovers all blocks in your collections and globals and injects Save/Apply buttons and the enhanced blocks drawer automatically. No changes to blocks or collections are needed.

2. Regenerate the Import Map

npx payload generate:importmap
# or: pnpm payload generate:importmap / bunx payload generate:importmap

3. SQL adapters only — run a migration

npx payload migrate:create create_presets
npx payload migrate

Skip if you use the MongoDB adapter.


Configuration

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,

  // Optional: collection overrides
  overrides: {
    access: {
      create: authenticated,
      read: authenticated,
      update: authenticated,
      delete: authenticated,
    },
    fields: (defaultFields) => [...defaultFields, customField],
    hooks: {
      beforeChange: [myHook],
    },
    admin: {
      defaultColumns: ["name", "type", "updatedAt"],
    },
  },
});

API Reference

presetsPlugin(config?)

Main plugin function. All options are optional.

| Option | Type | Default | Description | | ----------------- | -------------- | ------------------------------------------ | ------------------------------------------------------------------------- | | 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 (access, fields, hooks, admin) |

PresetType

interface 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
}

Translations

The plugin includes built-in translations for English and Spanish. Keys are under presetsPlugin:

  • presetsPlugin.presetActions.* - Save preset modal
  • presetsPlugin.applyPreset.* - Apply preset messages
  • presetsPlugin.blocksDrawer.* - Blocks drawer labels

Notes

  • The plugin automatically strips internal keys (id, blockType, blockName, experiment) when saving presets
  • Preview images are optional but recommended for better UX in the blocks drawer
  • The plugin also transforms blocks fields inside globals

License

MIT