Track visual edits made with VisBug and copy them with file paths for AI agents
npm install react-grab-visbug-copyTrack visual edits made with VisBug and copy them with file paths to give to AI agents.
This tool combines VisBug's visual editing capabilities with React Grab's selection system to help you:
1. šØ Visually edit any element on a page (colors, fonts, spacing, etc.)
2. š Track the changes you made
3. š Copy the changes as CSS + HTML to give to AI agents
``bash`
npm install react-grab-visbug-copyor
pnpm add react-grab-visbug-copy
`bash`Clone or download this repository
git clone https://github.com/jacksonkasi1/react-grab-visbug-copy.git
Add this to your app/layout.tsx:
`tsx
import { Script } from "next/script";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
$3
Add this to your
pages/_document.tsx:`tsx
import { Html, Head, Main, NextScript } from "next/document";
import Script from "next/script";export default function Document() {
return (
{process.env.NODE_ENV === "development" && (
<>
src="https://unpkg.com/react-grab/dist/index.global.js"
strategy="beforeInteractive"
/>
src="https://unpkg.com/react-grab-visbug-copy/dist/client/standalone.js"
strategy="lazyOnload"
/>
>
)}
);
}
`$3
Add this to your
index.html in the :`html
`Or import in your main entry file:
`tsx
// src/main.tsx or src/main.jsx
if (process.env.NODE_ENV === "development") {
import("react-grab");
import("react-grab-visbug-copy");
}import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
const root = ReactDOM.createRoot(document.getElementById("root")!);
root.render(
);
`$3
Add to your webpack config or HTML template:
`html
`Or use dynamic import in your entry file:
`javascript
if (process.env.NODE_ENV === "development") {
import("react-grab");
import("react-grab-visbug-copy");
}
`$3
`html
`Live Examples
Try these interactive examples to see VisBug Copy in action:
| Example | Description | Demo |
|---------|-------------|------|
| 01-basic-button.html | Simple button with hover effects | Click the button, edit styles with VisBug |
| 02-card-component.html | Card UI components | Edit cards with images and text |
| 03-navigation-bar.html | Navbar and hero section | Edit navigation and CTA buttons |
| 04-form-elements.html | Form inputs and buttons | Edit form styling and focus states |
$3
`bash
Clone the repository
git clone https://github.com/jacksonkasi1/react-grab-visbug-copy.gitOpen any example in your browser
open examples/web/01-basic-button.html
or
cd examples/web && python3 -m http.server 8080
Then visit http://localhost:8080/01-basic-button.html
`How It Works
1. Activate: Press
Cmd+C (Mac) or Ctrl+C (Windows) to activate React Grab overlay
2. Select: Click on any element to select it
3. Track: Press T to track the element's original styles
4. Edit: Use VisBug tools to make visual changes
5. Copy: Press C to copy the changesOutput Format
When you copy changes, you'll get output like:
Visual Changes
File Location
Track which file contains this componentChanges (2 style changes)
⢠background-color: rgb(102, 126, 234) ā rgb(214, 135, 92)
⢠font-size: 16px ā 24pxUpdated CSS
`css
button.btn {
background-color: rgb(214, 135, 92);
font-size: 24px;
}
`Updated HTML
`html
`---
Tracked with React Grab VisBug Copy
Example: Giving Changes to AI
Copy the output and paste to your AI:
> I changed the button background color to rgb(214, 135, 92) and increased
> the font size to 24px. Please apply these changes to the actual codebase.
>
> Here are the changes:
>
> [PASTE THE OUTPUT FROM VISBUG COPY]
Keyboard Shortcuts
| Shortcut | Action |
|----------|--------|
|
Cmd/Ctrl + C | Activate React Grab |
| T | Track selected element |
| C | Copy visual changes |
| X | Clear tracked changes |API
$3
`javascript
// Get the global API
const api = window.__REACT_GRAB_VISBUG_COPY__;// Track an element manually
api.track(element);
// Get all tracked elements
const elements = api.getTrackedElements();
// Clear all tracked changes
api.clear();
`Project Structure
`
react-grab-visbug-copy/
āāā src/
ā āāā client/
ā āāā standalone.ts # Main source code
āāā dist/
ā āāā client/
ā āāā standalone.js # ES module build
ā āāā standalone.cjs # CommonJS build
āāā examples/
ā āāā web/
ā āāā with-visbug-extension.html # Demo page
āāā package.json
āāā README.md
``- Chrome browser with VisBug extension installed
- React Grab library
- Modern browser with Clipboard API support
Include visual change diffs in PR descriptions to show what was modified.
Describe visual changes to AI and let it apply them to your codebase.
Track visual changes during design iteration and document them.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details.
- VisBug - Open source web design debug tools
- React Grab - Select context for coding agents
---
ā Star this repo if it helps you!