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

@digital-borders/puck-plugin-templates-manager

v0.4.0

Published

A plugin for Puck Editor that allows users to manage and use templates for their projects.

Downloads

274

Readme

Puck Templates Manager Plugin

npm version npm downloads license TypeScript Puck

A plugin for @puckeditor/core that allows users to create, save, and reuse custom templates directly inside the Puck editor.

This plugin enables editors and content creators to turn existing components into reusable templates and quickly insert them into pages, dramatically improving content creation speed and consistency.


📸 Screenshot


✨ Features

  • 📦 Create custom templates

    • Save the currently selected Puck component as a reusable template
    • Add name, description, and tags
    • Templates are fully serializable ComponentData[]
  • 📥 Import templates into a page

    • Insert templates anywhere in the page
    • Choose whether to insert before or after the selected component
    • Automatically regenerates component IDs to avoid collisions
  • 🔍 Search & filter templates

    • Fast search by template name
    • Clean dropdown UI for selection
  • 🧠 Editor-aware

    • Works relative to the currently selected block
    • Falls back to appending to page content when no block is selected
  • 🧩 Headless storage

    • You decide where templates are stored (DB, API, filesystem, etc.)
    • Plugin only requires a templates array and an onCreateTemplate handler

📦 Installation

npm install @digital-borders/puck-plugin-templates-manager
# or
pnpm add @digital-borders/puck-plugin-templates-manager
# or
yarn add @digital-borders/puck-plugin-templates-manager

🚀 Usage

1. Import the plugin

import { createTemplatesManagerPlugin } from "@digital-borders/puck-plugin-templates-manager";

2. Create the plugin instance

const templatesManagerPlugin = createTemplatesManagerPlugin({
  onCreateTemplate: (template) => {
    // Example: handle the creation of a new template
    console.log("New template created:", template);
  },

  templates: yourTemplatesArray, // pass existing templates to the plugin
});

3. Register it in Puck

import { Puck } from "@puckeditor/core";
import "@digital-borders/puck-plugin-templates-manager/styles.css";

function Editor() {
  return <Puck config={config} plugins={[templatesManagerPlugin]} />;
}

Notes on styling

  • The package ships precompiled Tailwind v4 styles. The host app does not need Tailwind.
  • Styles are scoped under .dbtm-root to avoid global side effects.
  • Import the package stylesheet exactly once from the host app.

🧠 How It Works

  • When saving a template:

    • The currently selected component is extracted
    • Metadata (name, description, tags) is added
    • The resulting ComponentData[] is passed to onCreateTemplate
  • When importing a template:

    • All component props.id values are regenerated using UUIDs
    • This prevents duplicated IDs inside the editor tree
    • Components are inserted relative to the selected block (or appended)

🧩 Requirements

  • React 18+
  • @puckeditor/core
  • A client-side environment ("use client")

🛠 Development (Vite)

Build the library bundle:

pnpm build:library

Run the demo app:

pnpm dev:demo

🧪 Tech Stack

  • TypeScript
  • React
  • @puckeditor/core
  • Vite (library build + demo)
  • Tailwind CSS
  • shadcn/ui
  • Radix UI

🤝 Contributing

Contributions are very welcome!

You can help by:

  • Improving the UI/UX
  • Adding template categories or grouping
  • Adding persistence adapters
  • Writing tests or documentation
  • propose new plugin ideas

Steps

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Open a pull request

📄 License

MIT © Digital Borders


💡 Ideas & Roadmap

  • Template preview thumbnails
  • Remote template libraries
  • Drag & drop insertion
  • Template versioning
  • Permissions & sharing

⭐ Acknowledgements

Built for the Puck ecosystem and inspired by real-world editor workflows.

If you find this plugin useful, consider giving the repo a ⭐️ and sharing it with your fellow developers!