Components
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.
npx shadcn@latest add https://21st.dev/r/21stdev/search-toolLoading preview...
import { SearchTool, type SearchResult } from "@/components/ui/search-tool";
const results: SearchResult[] = [
{ title: "United UA837 SFO→NRT · $1,105 economy", source: "google.com/flights" },
{ title: "SFO–Tokyo · 14 results from $1,089", source: "expedia.com" },
{ title: "ANA NH7 Direct SFO→NRT · $1,240 rt", source: "google.com/flights" },
];
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="best flights to Tokyo"
results={results}
defaultOpen
/>
</div>
</div>
);
}