Web research
Web research
Watch the agent search: the query types in, page icons stack up as it reads, then it folds into a trail of searches and the pages each one found.
Dependencies
Interaction states
- searching — A 1.4s sweep of light crosses "Searching" and the newest query opens in after it, typing as it goes.
- reading — The label morphs to "Reading" and "7 sites" rolls. Each page’s icon drops into the stack (four shown; the oldest folds away over 420ms and +N rolls) and its title rises out of a 4px blur as the last one lifts off.
- done — The same line rearranges into "3 searches · 9 sources": pieces open and fold over 460ms, counts roll, "sites" morphs to "sources", the title row folds shut and a chevron opens in. It opens into the queries and the page list.
- error — The label morphs to "Search failed" in red, still counting and listing anything found before it failed.
- cancelled — "Stopped after 2 searches", with what was found.
- trail — Opened, each search is a row on a thin line trail with its count ("12 threads"). A search on one site wears that site’s mark and reads "Searched Threadly for …" with the query in mono. Pages that say which search found them sit under it as up to five overlapping marks on a branch; the chevron folds them open into links (380ms). Pages without a search are listed after the trail.
Installation
Add this component with your preferred package manager.
pnpm dlx shadcn@4.21.5 add @cavemio/web-researchFirst install? Configure @cavemio once
Run npx shadcn@4.21.5 init if shadcn is not set up, then merge this entry into the registries field in your existing components.json. Keep your other settings and registries.
{
"registries": {
"@cavemio": "https://registry.cavemio.dev/r/cavemio-{name}.json"
}
}Where it’s used
AI search and answer tools
Show the pages being read while an answer is prepared.
Deep research agents
The searches an agent ran and the sources it read, kept after it finishes.
Support and docs assistants
Show which pages were searched before the assistant replied.
Market and competitor research
A trail of searches per site, with each result a link.
What it handles
- The search types in — “Searching” carries a sweep of light next to the live query as it types.
- Pages stack up as they are read — Each page drops its icon into an overlapping stack and its title rises in. The label becomes “Reading” and the site count rolls.
- It folds into a summary — The same line rearranges into “3 searches · 9 sources”, with a chevron that opens the full list.
- A trail of searches — Each search is a row with its result count, and pages that say which search found them sit under it.
- Every source is a link — Pages open in a new tab, so people can check what the agent read.
- Failed and stopped runs — It reads “Search failed” or “Stopped after 2 searches”, and still lists anything found before.
Usage
Interactive local fixture. Data and async results are simulated in the preview; the caller supplies application services.
import { WebResearch } from "@/components/web-research";
<WebResearch status="reading" queries={["annual plan discount benchmarks"]} sources={[{ url, title }]} />Props
| Prop | Type | Description |
|---|---|---|
| status | "searching" | "reading" | "done" | "error" | "cancelled" | – · Where the run is. |
| queries | (string | ResearchQuery)[] | – · Searches so far; the last one types in while searching. As { text, site?, siteIcon?, results?, resultLabel? } a search shows its site’s mark and its count on the trail. |
| sources | { url; title?; favicon?; query? }[] | – · Pages read, in order. Without a favicon, a monogram tinted from the site name; query (the index of the search that found it) groups it on the trail. |
| open / defaultOpen / onOpenChange | boolean / boolean / (open) => void | – · Whether the finished run shows its list. |
Accessibility & motion
- A polite status region beside the row reads "Searching for …", "Read 6 sites", then the finished summary. The counts and words are real text for screen readers; the rolling digits are hidden from them. - The row is one button from start to finish, disabled while the agent works, so nothing remounts and every piece can morph. Once done it has aria-expanded; the list is hidden from assistive tech and the tab order while folded. - The sweep of light is a moving mask, so it also covers letters that are mid-morph. Installs Number roll and Text morph alongside it. - Every source is a real link that opens in a new tab, so people can check the agent’s reading. - With reduced motion the query appears whole, there is no sweep, nothing rolls or slides, and the list opens instantly.
pnpm dlx shadcn@4.21.5 add @cavemio/web-research