React PlumberInstall package

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.

sh
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:

ts
// 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.

ts
// next.config.mjs
import { withPlumb } from '@unlocalhosted/react-plumber/next/config'
export default withPlumb(nextConfig)
ts
// app/%5F_plumb/[...path]/route.plumb.ts
import { createPlumbRoute } from '@unlocalhosted/react-plumber/next'
export const runtime = 'nodejs'
export const { GET, POST } = createPlumbRoute()
tsx
// 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:

sh
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

GestureWhat 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 + clickKeeps it open as an editor, with its notes in the bar.
Alt + two-finger scrollMoves up to the parent or down to the child.
?Lists every shortcut.

Edit text

GestureWhat happens
Double-clickEdits the words in place.
Alt + double-clickEdits the words in a button, card or link.
Enter, or click awayWrites them to the string they came from.
EscPuts 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.

KeyWhat it does
Alt + BTurns Blueprint on or off. Esc also leaves.
EnterStarts, then writes the fix in hand to your code.
← →Goes to the previous or next fix.
↑ ↓Tries another option on the live page.
KKeeps the value as it is.
Hold SpaceLets 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:

Undo history lives in the dev server. After a restart, earlier writes can’t be undone from the overlay.