Installation
React Grab can be installed automatically using the CLI or manually for more control.Automatic Installation (Recommended)
The easiest way to install React Grab is using the CLI tool:Run this command from your project root directory (where
next.config.ts or vite.config.ts is located).What the CLI Does
The initialization command automatically:- Detects your framework - Identifies Next.js, Vite, TanStack Start, or Webpack
- Detects your package manager - Works with npm, yarn, pnpm, or bun
- Installs dependencies - Adds
react-grabpackage - Configures your project - Modifies necessary files to load React Grab in development
- Shows a diff - Previews all changes before applying them
CLI Options
Customize the installation with these flags:-y, --yes- Skip confirmation prompts-f, --force- Force overwrite existing configuration-a, --agent <agent>- Connect to your agent (cursor, claude, copilot, mcp)-k, --key <key>- Set custom activation key (e.g., Meta+K, Ctrl+Shift+G, Space)--skip-install- Skip package installation-c, --cwd <cwd>- Specify working directory
Examples
Manual Installation
If you prefer manual installation or the automatic setup doesn’t work for your setup, follow the framework-specific instructions below.Next.js (App Router)
Add this to yourapp/layout.tsx:
app/layout.tsx
Next.js (Pages Router)
Add this to yourpages/_document.tsx:
pages/_document.tsx
Vite
Add this to yourindex.html:
index.html
Vite’s
import.meta.env.DEV ensures React Grab only loads in development mode.Webpack
Package Managers
React Grab works with all major package managers:Verification
After installation, verify React Grab is working:Open your application
Navigate to your application in a browser (usually
http://localhost:3000 or http://localhost:5173).Test element selection
Hover over any UI element and press:
- ⌘C on Mac
- Ctrl+C on Windows/Linux
Monorepo Support
For monorepos, the CLI automatically detects all React projects:Agent Integration
Connect React Grab to your coding agent:MCP Integration
For agents supporting Model Context Protocol:Manual Agent Setup
When installing, you can specify an agent:cursor- Cursor AIclaude- Claude Codecopilot- GitHub Copilotmcp- Model Context Protocol
Next Steps
Quick Start
Learn how to use React Grab effectively
GitHub Repository
View source code and contribute
