Skip to main content

Overview

The grab configure command allows you to customize React Grab’s behavior including activation keys, activation modes, and context options.

Usage

grab configure
Alias: grab config

Options

OptionAliasDescription
--yes-ySkip confirmation prompts
--key <key>-kActivation key (e.g., Meta+K, Ctrl+Shift+G, Space)
--mode <mode>-mActivation mode: toggle or hold
--hold-duration <ms>-Key hold duration in milliseconds (for hold mode)
--allow-input <boolean>-Allow activation inside input fields (true/false)
--context-lines <lines>-Max context lines to include
--cdn <domain>-CDN domain (e.g., unpkg.com, custom.react-grab.com)
--cwd <cwd>-cWorking directory (defaults to current directory)

Configuration Options

Activation Key

The keyboard shortcut to activate React Grab:
grab configure --key "Meta+K"
Supported modifiers:
  • Meta (Cmd on Mac, Win on Windows)
  • Ctrl
  • Shift
  • Alt (Option on Mac)
Supported keys:
  • Letters: a-z
  • Numbers: 0-9
  • Special keys: Space, Enter, Escape, Tab
  • Function keys: F1-F12
  • Symbols: `, -, =, [, ], \, ;, ', ,, ., /

Activation Mode

How the activation key behaves:
grab configure --mode toggle
  • Toggle — Press once to activate, press again to deactivate
  • Hold — Hold the key to keep React Grab active, release to deactivate

Key Hold Duration

Milliseconds to hold the key before activation (only for hold mode):
grab configure --hold-duration 200
Range: 0-2000ms
Default: 150ms

Allow Activation Inside Input

Whether to allow activation when focused on input fields:
grab configure --allow-input true

Max Context Lines

Number of surrounding code lines to include in copied context:
grab configure --context-lines 5
Range: 0-50
Default: 3

CDN Domain

Customize the CDN domain for loading React Grab:
grab configure --cdn custom.react-grab.com

Examples

Interactive Mode

Run without flags to use the interactive configuration wizard:
grab configure
1

Select option to configure

Search and select from available options:
? Search for an option to configure:
❯ Activation Key
  Activation Mode
  Key Hold Duration
  Allow Activation Inside Input
  Max Context Lines
2

Configure the option

Follow prompts based on the selected option:
? Type key combination (e.g. ctrl+shift+g):
❯ Ctrl+G
  Meta+K
  Space
  g
3

Review changes

Preview the code changes:
--- app/layout.tsx
+++ app/layout.tsx
@@ -10,6 +10,7 @@
       <Script
         src="//unpkg.com/react-grab/dist/index.global.js"
+        data-options='{"activationKey":"Meta+K"}'
         crossOrigin="anonymous"
       />
     )}
4

Apply changes

Confirm to save the configuration:
? Apply these changes? (Y/n)

Configure Multiple Options

Set multiple options at once:
grab configure \
  --key "Meta+K" \
  --mode toggle \
  --context-lines 5 \
  --allow-input true

Non-Interactive Configuration

Configure without prompts:
grab configure --key "g" --yes

Change CDN Domain

Use a custom CDN:
grab configure --cdn custom.react-grab.com

Output Example

$ grab configure --key "Meta+K"
 React Grab 0.0.1

 Preflight checks.

Configure React Grab options:

  Activation key: + K

--- app/layout.tsx
+++ app/layout.tsx
@@ -10,6 +10,7 @@
       <Script
         src="//unpkg.com/react-grab/dist/index.global.js"
+        data-options='{"activationKey":"Meta+K"}'
         crossOrigin="anonymous"
       />
     )}

? Apply these changes? (Y/n)

 Applying changes to app/layout.tsx.

Success! React Grab options have been configured.

Advanced Configuration

Combined Options Example

grab configure \
  --key "Ctrl+Shift+G" \
  --mode hold \
  --hold-duration 200 \
  --allow-input false \
  --context-lines 5
Results in:
<Script
  src="//unpkg.com/react-grab/dist/index.global.js"
  data-options='{
    "activationKey": "Ctrl+Shift+G",
    "activationMode": "hold",
    "keyHoldDuration": 200,
    "allowActivationInsideInput": false,
    "maxContextLines": 5
  }'
  crossOrigin="anonymous"
/>

Interactive Key Selection

The interactive mode provides smart suggestions:
? Type key combination (e.g. ctrl+shift+g):
❯ Ctrl+G
  Ctrl+K
  Ctrl+E
  Meta+G
  Meta+K
  Space
  g
  k
Type to filter suggestions:
? Type key combination (e.g. ctrl+shift+g): ctrl+shift
❯ Ctrl+Shift+G
  Ctrl+Shift+K
  Ctrl+Shift+E
  Ctrl+Shift+Space

Troubleshooting

React Grab Not Installed

✖ Preflight checks.

✗ React Grab is not installed.
Run react-grab init first to install React Grab.
Solution: Run grab init first.

Invalid Mode

✗ Invalid mode: invalid. Use "toggle" or "hold".
Solution: Use toggle or hold for the --mode flag.

Invalid Hold Duration

✗ Invalid hold duration. Must be 0-2000ms.
Solution: Provide a value between 0 and 2000.

Invalid Context Lines

✗ Invalid context lines. Must be 0-50.
Solution: Provide a value between 0 and 50.

No Changes Needed

If the configuration is already set:
✔ Preflight checks.

No changes needed.

Configuration Persistence

Configurations are stored in your code via the data-options attribute:
<Script
  src="//unpkg.com/react-grab/dist/index.global.js"
  data-options='{"activationKey":"Meta+K","maxContextLines":5}'
  crossOrigin="anonymous"
/>
For programmatic usage, pass options to the init function or React component:
import { ReactGrab } from "react-grab";

<ReactGrab
  activationKey="Meta+K"
  activationMode="toggle"
  maxContextLines={5}
/>
  • grab init — Initialize React Grab in your project
  • grab add — Connect React Grab to your coding agent
  • grab remove — Disconnect agent integrations

Build docs developers (and LLMs) love