Skip to content
18 changes: 15 additions & 3 deletions apps/web/content/docs/grab.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: grab and inspect
meta_title: Grab and inspect elements for a coding agent with knobs
description: Grab any element on the page and copy its html, the components that rendered it and their source files for a coding agent, or inspect its box and css.
order: 5
updated: 2026-11-05
updated: 2026-11-26
---

## grab
Expand All @@ -17,10 +17,22 @@ the components that rendered it and where they live go on the clipboard:

paste that into your agent and it can find the code.

- shift and a click gather several elements, one line each.
- the arrows move to the parent, a child or a sibling. enter or `c` copies.
- drag a box, or shift and a click, to gather several elements. each gets a
number, and a tray at the bottom lists them, with a note for each and one
for all. `n` writes a note.
- enter, `c` or the tray's copy button copies them all, numbered, each note
under its element.
- the arrows move to the parent, a child or a sibling.
- escape or `⇧G` again turns grab off.

```
1. [<button type="button">Save</button> in SaveButton (at src/App.jsx:5:5)]
Note: make it blue
2. [<a href="/docs">Docs</a> in Nav (at src/Nav.jsx:12:9)]

Note: same spacing for all of these
```

for a file, a line and a column on every component, React needs a devtools
hook from its first render: the React devtools extension, or the
[early script](/docs/start).
Expand Down
35 changes: 33 additions & 2 deletions apps/web/content/reference/grab.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,45 @@ while it is on:
- a click copies the element, and grab ends. the page's own click, mouse and
pointer handlers never hear of it, and its hover handlers neither.
- shift and a click gather elements, lighter boxes, and a second one takes one
back out. letting go of shift, or a click without it, copies them all, one
line each.
back out. `⇧↩` (`Shift Enter` off a Mac) gathers the boxed element or takes
it back out, and backspace or delete takes it out. letting go of shift copies
nothing: what is gathered stays until a copy, escape or its removal.
- drag a box on the page, with shift or without, to gather every element fully
inside it: the outermost ones, in page order, 30 at most. those it would take
show lighter boxes while you drag. ones gathered before stay, and a drag
never copies. knobs' own ui, hidden elements, shadow roots and frames are
left out.
- each gathered element shows its number, 1, 2, 3 in the order it was
gathered, in a badge at its box's top left. the numbers close up when one
goes.
- a tray at the bottom of the window lists them: the number, the tag and the
component, a one-line note and a remove button. under the list are a note
for all and a "Copy N" button. `n` writes the boxed element's note where it
is gathered, or else the note for all. enter in a note, or `⌘↩` (`Ctrl
Enter` off a Mac) anywhere, copies. escape in the tray goes back to picking,
and what is typed in it never moves the box or copies.
- a click without shift, enter, `c` or the tray's button copies them all, the
clicked one last where it is new, and grab ends.
- up goes to the parent, down back the way it came or to the first child, left
and right (and tab, shift-tab) to the previous and the next element, siblings
first, then the sibling of the nearest parent that has one. enter or `c`
copies.
- a check and "Copied" show by the element for a moment, the box still on it.

one element with no notes copies as its line alone. more than one, or a note,
and each element is numbered, its note on the next line under it, and the note
for all goes last after a blank line. empty notes are left out:

```
1. [<button type="button">Save</button> in SaveButton (at src/App.jsx:5:5)]
Note: make it blue
2. [<a href="/docs">Docs</a> in Nav (at src/Nav.jsx:12:9)]

Note: same spacing for all of these
```

the json carries each element's `note`, and the note for all as `note`.

the context of the element under the pointer is worked out while the pointer
rests there, so a click copies it whole, inside the click, as Safari wants.
where it is not ready yet, the click copies it without lines and columns, by
Expand Down
7 changes: 7 additions & 0 deletions packages/devknobs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# changelog

## Unreleased

- grab gathers many elements: drag a box around them, or shift and a click. each shows its number
- a tray lists what is gathered, with a note for each and one for all. `n` writes a note, enter, `c` or the tray's button copies them all
- more than one element, or a note, copies numbered, each note under its element and the note for all last
- letting go of shift no longer copies

## 0.7.5

- the page under Safari's bottom bar lines up with the page above it on pages that pin a section while they scroll, and on any page with a viewport length in a class name, such as Tailwind's `h-[260svh]`
Expand Down
Loading
Loading