Guides
The overlay in your app
The overlay is Plumber in your browser, while your app runs in development. It shows what an element is made of and which values aren’t on your tokens, and writes the fix you choose to your source. Production builds don’t include it.
Set it up
plumber install --overlay looks at your project and prints the setup. Add --write to make the change and see the diff.
npx plumber install --overlay
npx plumber install --overlay --write
Vite
Add one plugin before react(), so it can record where each tag was written before React compiles it:
// vite.config.ts
import { plumb } from '@unlocalhosted/react-plumber/vite'
import react from '@vitejs/plugin-react'
export default { plugins: [plumb(), react()] }
The plugin runs in vite dev only. The dev server stops and names the line to move if the plugin comes after react().
Next.js (App Router)
Next.js needs a config wrapper, a route that serves the overlay, and a component in your root layout.
// next.config.mjs
import { withPlumb } from '@unlocalhosted/react-plumber/next/config'
export default withPlumb(nextConfig)
// app/%5F_plumb/[...path]/route.plumb.ts
import { createPlumbRoute } from '@unlocalhosted/react-plumber/next'
export const runtime = 'nodejs'
export const { GET, POST } = createPlumbRoute()
// app/layout.tsx, inside <body>
import { PlumbOverlay } from '@unlocalhosted/react-plumber/next/overlay'
<PlumbOverlay />
The folder is named %5F_plumb because Next.js treats folders that start with _ as private. Keep the .plumb.ts ending on the route: it is what keeps the route out of production builds.
Other dev servers
Run Plumber’s own server beside yours, then ask for the script tag:
npx plumber serve --overlay --origin http://localhost:5555
npx plumber install --overlay
The second command prints a tag with the running server’s port and token. Paste it into development pages only, and print it again after you restart Plumber, because the token changes.
Inspect an element
| Gesture | What happens |
|---|---|
| Hold Alt (Option on a Mac) | The X-ray shows the element under the pointer: what it is, what is wrong and what to do. |
| Alt + click | Keeps it open as an editor, with its notes in the bar. |
| Alt + two-finger scroll | Moves up to the parent or down to the child. |
| ? | Lists every shortcut. |
Edit text
| Gesture | What happens |
|---|---|
| Double-click | Edits the words in place. |
| Alt + double-click | Edits the words in a button, card or link. |
| Enter, or click away | Writes them to the string they came from. |
| Esc | Puts the words back. |
Fix the page with Blueprint
Press Alt + B. The bar lists each group of checks with its count. Pick a group to see its notes on the page, or start fixing and take one cause at a time. A cause is one problem with every place it occurs, and one fix rewrites all of those places.
| Key | What it does |
|---|---|
| Alt + B | Turns Blueprint on or off. Esc also leaves. |
| Enter | Starts, then writes the fix in hand to your code. |
| ← → | Goes to the previous or next fix. |
| ↑ ↓ | Tries another option on the live page. |
| K | Keeps the value as it is. |
| Hold Space | Lets you use the page underneath. |
When no token fits, Plumber can offer a new one. Taking it adds the token to your theme and uses it everywhere that cause occurs, with Undo. Clean up, in the bar’s menu, goes over the whole page one pass at a time.
Test with harder content
Press Alt + S for Break it. It stretches what can change on the page, such as longer words, narrower widths, bigger text and empty or long lists, and shows what breaks. Press F on a note to see its fix.
When a fix lands
A fix lands as a hot update, so what you were doing on the page stays. On Vite this needs a React plugin with Fast Refresh. Without one, each fix reloads the page once. A change to the page’s HTML file also reloads it.
What it won’t write
Plumber writes only an exact edit it can confirm, and says why when it can’t:
- The file changed after Plumber read it. The write is refused, and your change is left alone.
- The code isn’t yours: installed packages, generated files and anything outside the project.
- The value is built at runtime, like a class assembled from a variable, or text from an expression.
- No option is chosen, because several tokens fit or none is close enough.
Undo history lives in the dev server. After a restart, earlier writes can’t be undone from the overlay.