aidenybai/react-grab
aidenybai/react-grab has 7,705 GitHub stars and 342 forks. GitHot measured -1 stars in 24 hours and +10 in 7 days. Last checked 2026-11-08 15:59 UTC. Last push 2026-08-22.
에이전트를 위해 UI 요소를 복사하세요
측정된 스타 증가
- in 24h
- -1
- in 7 days
- +10
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
React Grab
Copy any UI element for your agent.
React Grab points agents to the actual source behind each selection. Agents are 2× faster and more accurate when using React Grab.
Quick Start
Run this at your project root:
npx grab@latest init
How It Works
React Grab turns a browser selection into source context your agent can use:
- Hover any UI element in your app.
- Press ⌘C or Ctrl+C.
- Paste the copied context into your agent.
The copied context includes the selected element and its component stack with source locations:
[<a class="ml-auto inline-block text-sm" href="#">Forgot your password?</a> in LoginForm (at components/login-form.tsx:46:19)]
Manual Installation
If you cannot use the CLI, install React Grab manually for your framework:
Next.js (App router)
Add this inside your app/layout.tsx:
import Script from "next/script";
export default function RootLayout({ children }) {
return (
<html>
<head>
{process.env.NODE_ENV === "development" && (
<Script
src="//unpkg.com/react-grab/dist/index.global.js"
crossOrigin="anonymous"
strategy="beforeInteractive"
/>
)}
</head>
<body>{children}</body>
</html>
);
}
Next.js (Pages router)
Add this into your pages/_document.tsx:
import { Html, Head, Main, NextScript } from "next/document";
export default function Document() {
return (
<Html lang="en">
<Head>
{process.env.NODE_ENV === "development" && (
<Script
src="//unpkg.com/react-grab/dist/index.global.js"
crossOrigin="anonymous"
strategy="beforeInteractive"
/>
)}
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
Vite
Add this at the top of your main entry file (e.g., src/main.tsx):
if (import.meta.env.DEV) {
import("react-grab");
}
Webpack
First, install React Grab:
npm install react-grab
Then add this at the top of your main entry file (e.g., src/index.tsx or src/main.tsx):
if (process.env.NODE_ENV === "development") {
import("react-grab");
}
Build your own React Grab
Build a custom interface with the selection engine from react-grab/primitives. Use its APIs for hit testing, source context, page freezing, clipboard access, and editor navigation.
Customize hit testing
Scope hit testing to a container or replace the default element filter with your own rules.
import { getElementAtPoint, isElementGrabbable } from "react-grab/primitives";
export const getPickerTarget = (
event: PointerEvent,
appElement: Element,
toolbarElement: Element,
): Element | null =>
getElementAtPoint(event.clientX, event.clientY, {
container: appElement,
filter: (candidate) => isElementGrabbable(candidate) && !toolbarElement.contains(candidate),
});
Add data-react-grab-ignore to your picker interface so hit testing skips its subtree.
Resources & Contributing Back
Want to try it out? Check out our demo.
Looking to contribute back? Check out the Contributing Guide.
Want to talk to the community? Hop in our Discord and share your ideas and what you've built with React Grab.
Find a bug? Head over to our issue tracker and we'll do our best to help. We love pull requests, too!
We expect all contributors to abide by the terms of our Code of Conduct.
License
React Grab is MIT-licensed open-source software.
Thank you to Andrew Luetgers for donating the grab npm package name.
관련 프로젝트 살펴보기
freeCodeCamp/freeCodeCamp
freeCodeCamp.org의 오픈 소스 코드베이스와 커리큘럼입니다. 수학, 프로그래밍, 컴퓨터 과학을 무료로 배울 수 있습니다.
458,763 스타donnemartin/system-design-primer
대규모 시스템 설계 방법을 배우고 시스템 설계 면접을 준비할 수 있습니다. Anki 플래시카드가 포함되어 있습니다.
377,348 스타react/react
웹과 네이티브 사용자 인터페이스를 위한 라이브러리.
252,415 스타vuejs/vue
Vue 2 저장소입니다. Vue 3은 https://github.com/vuejs/core를 방문하세요.
212,632 스타