orbit/plugin-template
2026-06-20 05:59:39 +00:00
..
src feat(plugins): compiled-plugin support — expose React/ReactDOM/jsx-runtime/Fragment as externalization targets, add settings_section slot (addSettingsSection) wired into Settings, + plugin-template/ (Vite build with React externalized) and docs 2026-06-20 05:42:02 +00:00
.gitignore feat(plugins): compiled-plugin support — expose React/ReactDOM/jsx-runtime/Fragment as externalization targets, add settings_section slot (addSettingsSection) wired into Settings, + plugin-template/ (Vite build with React externalized) and docs 2026-06-20 05:42:02 +00:00
package.json feat(plugins): compiled-plugin support — expose React/ReactDOM/jsx-runtime/Fragment as externalization targets, add settings_section slot (addSettingsSection) wired into Settings, + plugin-template/ (Vite build with React externalized) and docs 2026-06-20 05:42:02 +00:00
README.md docs: describe the compiled-plugin path generically (externalized-React model) 2026-06-20 05:59:39 +00:00
tsconfig.json feat(plugins): compiled-plugin support — expose React/ReactDOM/jsx-runtime/Fragment as externalization targets, add settings_section slot (addSettingsSection) wired into Settings, + plugin-template/ (Vite build with React externalized) and docs 2026-06-20 05:42:02 +00:00
vite.config.ts feat(plugins): compiled-plugin support — expose React/ReactDOM/jsx-runtime/Fragment as externalization targets, add settings_section slot (addSettingsSection) wired into Settings, + plugin-template/ (Vite build with React externalized) and docs 2026-06-20 05:42:02 +00:00

Orbit plugin template

A starter for a compiled Orbit plugin — write real React/TSX with hooks and build it down to a single droppable .js file (a compiled, externalized-React plugin model, in React/Vite).

Build

npm install
npm run build      # → dist/orbit-plugin-template.js

react, react-dom and react/jsx-runtime are marked external in vite.config.ts and mapped to Orbit.React / Orbit.ReactDOM / Orbit.jsxRuntime. So your bundle does not contain its own React — at runtime it shares Orbit's single instance. (Bundling your own React would break hooks with "invalid hook call".)

Deploy

  1. Copy dist/orbit-plugin-template.js to where Orbit can fetch it, e.g. /app/plugins/orbit-plugin-template.js.

  2. List it in the deployed config.json (no rebuild of Orbit needed):

    { "plugins": ["/app/plugins/orbit-plugin-template.js"] }
    
  3. Reload. The example adds a 🤷 composer button and a Template section in Settings.

Write your plugin

Edit src/index.tsx. The Orbit global and the per-plugin orbit API are typed in src/orbit.d.ts. See Orbit's docs/PLUGINS.md for the full API and event list.