asanshay

Chat Tool

AI chats 10

About

A chat component that displays an AI tool call, its input and output, inside a collapsible accordion.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Chat Tool to your project and fits it to your theme.

Code

How Chat Tool is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import ChatTool from "@/components/ui/chat-tool";
import type { ToolUIPart } from "ai";

const toolPart = {
  type: "tool-getWeather",
  toolCallId: "call_1",
  state: "output-available",
  input: { city: "San Francisco", unit: "celsius" },
  output: { temperature: 18, condition: "Partly cloudy" },
} as ToolUIPart;

export default function ChatToolDemo() {
  return (
    <div className="w-full max-w-md mx-auto p-6">
      <ChatTool toolMessagePart={toolPart} />
    </div>
  );
}

Dependencies

More by asanshay

View all
  • Chat Reasoning

    Chat Reasoning

    131
  • Shader Loader

    Shader Loader

    69
  • Motion Blur Text

    Motion Blur Text

    36
  • Reveal

    Reveal

    14
  • Chat Message

    Chat Message

    7
  • Page Header

    Page Header

More in AI chats

View all
  • AI Actions

    AI Actions

    320
  • Color Picker

    Color Picker

    83
  • Message Thread

    Message Thread

    37
  • System Message

    System Message

    54
  • Commit

    Commit

    17
  • Agent Chat

    Agent Chat

    17
  • Permission Grant

    Permission Grant

    10
  • Suggestions

    Suggestions

    28