About
Render grouped search results as a collapsible tool card. State-driven (searching shimmer / done static). Provide a query and an optional results array. Self-contained port from 21st.dev Agent Elements.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Search Tool to your project and fits it to your theme.
Code
How Search Tool is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import { SearchTool, type SearchResult } from "@/components/ui/search-tool";
const results: SearchResult[] = [
{ title: "RFC: Streaming agent UI primitives", source: "github.com", date: "Mar 12" },
{ title: "Designing tool cards for chat surfaces", source: "blog.21st.dev", date: "Mar 06" },
{ title: "Why we shipped Agent Elements", source: "x.com", date: "Feb 28" },
];
export default function Demo() {
return (
<div className="flex items-center justify-center w-full min-h-screen bg-background p-8 overflow-hidden">
<div className="w-full max-w-md">
<SearchTool
state="done"
query="agent UI design references"
results={results}
defaultOpen
/>
</div>
</div>
);
}















