Documentation Plugins

Plugins

Build a plugin

builder

Last updated Sep 29, 2026

A Popcorn plugin is a manifest plus JavaScript code. It can add a menu command, open a panel, and work with the active document through the popcorn API. Start with one command that makes a small, visible change so you can check the permission and undo behavior.

Make a manifest

Host a manifest.json and the script it names at URLs the browser can fetch. A minimal drawing plugin declares code, API version 1.0, and content:write permission. Add ui only if it opens a panel. Declare network and explicit allowed domains if the code needs remote data. The manifest may supply up to eight menu commands.

{
  "name": "Hello Shapes",
  "code": "plugin.js",
  "api": "1.0",
  "permissions": [
    "content:write"
  ],
  "menu": [
    {
      "command": "add",
      "label": "Add a rectangle"
    }
  ]
}

In plugin.js, register a run handler and use the document API instead of editing canvas internals:

popcorn.on('run', async () => {
  await popcorn.createRectangle({
    x: 40,
    y: 40,
    width: 120,
    height: 80,
    fill: '#e5e5e5'
  });
  popcorn.notify('Rectangle added');
});

Test it

Open Plugins → Manage → Developer and load the manifest URL. Run the command on a throwaway design, then check selection, undo, and any error message. Developer installs stay in this browser. To make a plugin available through Browse, it must be published to the curated catalog.

Other useful document methods include selection(), currentPage(), createText(), createImage(), update(), remove(), and batch(). Use batch() when several changes should form one undo step. Review permissions and safety before adding more access, and test every method against the API version in your manifest.