Skip to content

feat: Smart Props Editor Plugin for live prop editing#289

Draft
aidenybai wants to merge 2 commits intomainfrom
cursor/props-editor-plugin-4173
Draft

feat: Smart Props Editor Plugin for live prop editing#289
aidenybai wants to merge 2 commits intomainfrom
cursor/props-editor-plugin-4173

Conversation

@aidenybai
Copy link
Copy Markdown
Owner

@aidenybai aidenybai commented Apr 10, 2026

Summary

Adds a new built-in plugin props-editor that enables live editing of React component props directly from the React Grab overlay. Users can select an element, open the context menu, and click "Props" (or press P) to launch a floating editor panel.

How it works

Select element → Context menu → "Props" action → Floating panel → Edit values → Live update

Prop Type Inference

Two-layer inference system determines the appropriate editor for each prop:

Context-aware rules (prop name determines editor):

  • children (string) → Textarea
  • style (object) → Expandable CSS sub-editor section
  • className → Text input
  • src, href → URL input with link preview
  • disabled, checked, hidden, etc. → Toggle switch
  • placeholder, title, alt, etc. → Text input
  • onClick, onChange, etc. → Read-only "(event handler)" badge
  • key, ref, $$typeof → Hidden (internal React props)

Type-aware fallback (value type as fallback):

  • String matching #hex or rgb(...) → Color picker
  • String → Text input
  • Number → Number input with stepper
  • Boolean → Toggle
  • Object → Expandable key-value editor
  • Function → Read-only "(function)"

Style sub-editors (CSS property-aware):

  • color, backgroundColor, etc. → Color picker
  • fontSize, width, padding*, etc. → Number + unit dropdown (px/rem/em/%)
  • fontWeight → Select (100-900 / normal/bold)
  • display → Select (block/flex/grid/none/...)
  • position → Select (static/relative/absolute/fixed/sticky)
  • overflow → Select (visible/hidden/scroll/auto)

Applying Changes

  • Host fibers (div, span, etc.): Sets fiber.pendingProps + fiber.alternate.pendingProps, then calls renderer.scheduleUpdate(fiber)
  • Composite fibers (components): Uses renderer.overrideProps(fiber, path, value) via the React DevTools protocol, falling back to direct pendingProps mutation

Panel UI

  • Shadow DOM isolation (same pattern as mount-root.ts) for zero style conflicts
  • Draggable header for repositioning
  • Viewport-aware initial positioning (anchored near selected element)
  • Scrollable body for many props
  • Reset button to restore original memoizedProps
  • Auto-hides on deactivate or new element selection

Files changed

  • packages/react-grab/src/core/plugins/props-editor.ts — New plugin (prop inference, panel UI, prop application, plugin wiring)
  • packages/react-grab/src/core/index.tsx — Register propsEditorPlugin as a built-in

Testing

  • All 564 existing E2E + unit tests pass
  • Typecheck passes with zero errors
  • Lint passes with zero new warnings
  • Format applied
Open in Web Open in Cursor 

Summary by cubic

Adds a built-in props-editor plugin to edit React component props live from the overlay. Open it from the context menu “Props” action or press P to launch a floating editor panel.

  • New Features

    • Adds “Props” action (shortcut P) to open a floating, draggable panel near the selected element. Shadow DOM isolated.
    • Smart editors for common props and CSS: handles children, style, boolean HTML attrs, and read-only event handlers; fallbacks include color pickers, numbers, toggles, and object expanders.
    • CSS sub-editors for colors, size props (number + unit), and selects for display, position, overflow, fontWeight.
    • Live updates via pendingProps/scheduleUpdate for host nodes and overrideProps for components; Reset restores original memoizedProps; auto-hides on deactivate or new selection; registered as a built-in in packages/react-grab/src/core/index.tsx.
  • Refactors

    • Formatting cleanups in packages/react-grab/package.json and src/core/store.ts (no functional changes).

Written for commit 208a65d. Summary will update on new commits.

- Plugin registers a 'Props' action in context menu with 'P' shortcut
- Floating panel with Shadow DOM isolation for style encapsulation
- Context-aware prop inference: style objects get CSS sub-editors,
  event handlers show read-only badges, boolean HTML attrs get toggles
- Type-aware fallback: color pickers for hex/rgb strings, number
  steppers for numeric values, expandable key-value for objects
- Style sub-editors: color pickers for *Color props, number+unit
  dropdowns for size props, selects for display/position/overflow
- Live prop application for host fibers (pendingProps + scheduleUpdate)
  and composite fibers (overrideProps via React DevTools protocol)
- Reset button restores original memoizedProps
- Draggable panel header, viewport-aware positioning
- Hides on deactivate, element select, or explicit close

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gym Ready Ready Preview, Comment Apr 10, 2026 11:56am
react-grab-website Ready Ready Preview, Comment Apr 10, 2026 11:56am

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

Open in StackBlitz

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/cli@289
npm i https://pkg.pr.new/aidenybai/react-grab/grab@289
npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/mcp@289
npm i https://pkg.pr.new/aidenybai/react-grab@289

commit: 208a65d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants