Компоненты
- Accordion
- Alert
- Alert Dialog
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Button
- Calendar
- Card
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Date Picker
- Dialog
- DrawerNew
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Meter
- Number Field
- OTP FieldNew
- Pagination
- Popover
- Preview Card
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Toolbar
- Tooltip
AI Components
- AI Components
- Chat Conversation
- Chat Message
- Chat Response
- Chat Suggestion
- Chat Prompt Input
- Chat Attachments
- Chat Code Block
- Chat Image
- Chat Inline Citation
- Chat Reasoning
- Chat Sources
- Chat Actions
- Chat Context
- Chat Loader
- Chat Task
- Chat Tool
- Chat Web Preview
- Chat Snippet
- Chat Terminal
- Chat Stack Trace
- Chat Test Results
- Chat File Tree
- Chat Environment Variables
- Chat Audio Player
- Chat Transcription
- Chat Speech Input
- Chat Mic Selector
- Chat Voice Selector
- Chat Agent
- Chat Persona
- Chat Connection
- Chat Queue
- Chat Checkpoint
- Chat Confirmation
- Chat Artifact
- Chat JSX Preview
- Chat Schema Display
- Chat Package Info
- Chat Commit
- Chat Plan
- Chat Panel
- Chat Open In Chat
- Chat Sandbox
- Chat Model Selector
- Chat Canvas
- Chat Node
- Chat Edge
Resources
Chat Tool
Tool-call render с статус-badge, параметрами и результатом.
J
Parameters
input.json
{ "query": "Next.js 16 Cache Components vs revalidate", "limit": 5, "freshness": "1w"}Result
output.json
{ "results": [ { "title": "Cache Components — Next.js docs", "url": "https://nextjs.org/docs/app/getting-started/cache-components", "snippet": "Cache Components let you cache the result of rendering a Server Component and reuse it across requests." }, { "title": "use cache directive", "url": "https://nextjs.org/docs/app/api-reference/directives/use-cache", "snippet": "Mark a component as cacheable. Invalidate via updateTag or updateCache." } ]}import {
ChatMessage,
ChatMessageAvatar,
ChatMessageContent,
} from "@/components/ui/chat-message";
import {
ChatTool,
ChatToolContent,
ChatToolHeader,
ChatToolInput,
ChatToolOutput,
} from "@/components/ui/chat-tool";
const output = {
results: [
{
title: "Cache Components — Next.js docs",
url: "https://nextjs.org/docs/app/getting-started/cache-components",
snippet:
"Cache Components let you cache the result of rendering a Server Component and reuse it across requests.",
},
{
title: "use cache directive",
url: "https://nextjs.org/docs/app/api-reference/directives/use-cache",
snippet:
"Mark a component as cacheable. Invalidate via updateTag or updateCache.",
},
],
};
export default function Particle() {
return (
<div className="w-full max-w-2xl p-4">
<ChatMessage from="assistant">
<ChatMessageAvatar fallback="J" />
<ChatMessageContent>
<ChatTool defaultOpen>
<ChatToolHeader state="completed" toolName="web_search" />
<ChatToolContent>
<ChatToolInput
input={{
query: "Next.js 16 Cache Components vs revalidate",
limit: 5,
freshness: "1w",
}}
/>
<ChatToolOutput output={output} />
</ChatToolContent>
</ChatTool>
</ChatMessageContent>
</ChatMessage>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @jenny/chat-tool
Usage
import {
ChatTool,
ChatToolContent,
ChatToolHeader,
ChatToolInput,
ChatToolOutput,
} from "@/components/ui/chat-tool";
<ChatTool defaultOpen>
<ChatToolHeader toolName="web_search" state="completed" />
<ChatToolContent>
<ChatToolInput input={{ query: "Next.js 16 cache components", limit: 5 }} />
<ChatToolOutput output={results} />
</ChatToolContent>
</ChatTool><ChatToolInput> и <ChatToolOutput> рендерят JSON через chat-code-block (с подсветкой shiki + copy-button). Если output — это React-нода, она пройдёт как есть.
Состояния
state: 'pending' | 'running' | 'approval-requested' | 'completed' | 'denied' | 'error' — меняет иконку и текст в badge заголовка.
При errorText блок Output показывает destructive-стилизацию вместо result.
On This Page