Overlay Helpers
The@wormkey/overlay package provides helpers to automatically inject the Wormkey control bar without manual script tags.
Installation
Auto-Mount (/auto)
Automatically detect and load the overlay script on page load.
Usage
Import at your app entry point:Configuration
- Meta Tag
- Window Global
- Direct Call
Add a meta tag to your HTML:The auto script reads this tag and injects the overlay.
How It Works
Detect script URL
Checks (in order):
- Function parameter
window.__WORMKEY_OVERLAY_URL__<meta name="wormkey-overlay-url">
Return Value
Theauto() function returns a boolean:
Express Middleware (/express)
Automatically inject the overlay script into HTML responses.
Usage
Options
scriptUrl (required)
Full overlay script URL:
How It Works
Dynamic Script URL
Read from environment variables:Use with Other Middleware
Place after body parsers, before routes:React Component (/react)
For React and Next.js apps, use the <WormkeyOverlay /> component:
Comparison
| Helper | Use Case | Framework |
|---|---|---|
/auto | Auto-detect and inject | Vanilla JS, Vite, Webpack |
/express | Server-side HTML injection | Express, Node.js |
/react | React component | React, Next.js |
Local Development
When usingwormkey http 3000 --local, update URLs:
Manual Script Tag
If you prefer not to use helpers, add the script tag directly:Related
- React Integration - React component details
- CLI Reference - Get the overlay script URL from CLI output