Components
Collapsible header summarizing nested tool calls (files / searches / commands). State-driven (completed / pending streaming / interrupted) with shimmer label and elapsed time. Self-contained port from 21st.dev Agent Elements.
npx shadcn@latest add https://21st.dev/r/21stdev/tool-groupLoading preview...
"use client";
import { ToolGroup } from "@/components/ui/tool-group";
const nestedTools = [
{ category: "file" as const, title: "Read", subtitle: "src/app/layout.tsx" },
{
category: "search" as const,
title: "Grep",
subtitle: "useChat",
},
{ category: "file" as const, title: "Read", subtitle: "src/app/page.tsx" },
{
category: "search" as const,
title: "WebSearch",
subtitle: "ai sdk v6",
},
{
category: "file" as const,
title: "Read",
subtitle: "src/components/chat.tsx",
},
{
category: "search" as const,
title: "Grep",
subtitle: "<Message",
},
{
category: "file" as const,
title: "Read",
subtitle: "src/components/message.tsx",
},
{
category: "file" as const,
title: "Read",
subtitle: "src/components/composer.tsx",
},
{
category: "search" as const,
title: "Grep",
subtitle: "tool-",
},
{
category: "search" as const,
title: "Glob",
subtitle: "src/**/*.tsx",
},
{
category: "file" as const,
title: "Read",
subtitle: "src/lib/tools.ts",
},
{
category: "file" as const,
title: "Read",
subtitle: "src/lib/agent.ts",
},
];
export default function Demo() {
return (
<div className="min-h-screen w-full flex items-center justify-center p-6 bg-white dark:bg-neutral-950">
<div className="w-full max-w-[420px]">
<ToolGroup
state="pending"
nestedTools={nestedTools}
completeLabel="Explored"
shimmerLabel="Exploring"
interruptedLabel="Exploration interrupted"
maxVisibleTools={5}
defaultOpen
/>
</div>
</div>
);
}
Loading preview...
Loading preview...