nextui.dev
Home
Docs
Saved
Pricing
Components37
  • Forms & inputs7
  • Cards13
  • Buttons, badges & avatars8
  • Feedback & display6
  • Effects3
Agents17
  • Chat inputNew
  • Task checklistNew
  • ReasoningNew
  • Tool callNew
  • Tool approvalNew
  • SourcesNew
  • Agent timelineNew
  • Artifact panelNew
  • Streaming messageNew
  • Conversation shellNew
  • Voice agentNew
  • Voice orbNew
  • Thinking ring
  • Thinking waveNew
  • Thinking sparkle
  • Thinking bot
  • Prompt deckNew
Blocks20
  • Agent chatNew
  • Pill heroNew
  • Grid hero
  • Moodboard generatorNew
  • Waitlist heroNew
  • Intro bannerNew
  • Creative home heroNew
  • Chat heroNew
  • App shelfNew
  • Usage card
  • Design resultsNew
  • Pricing tiers
  • Dashboard home
  • The shiftNew
  • Launch perksNew
  • Testimonials
  • Quote
  • Team
  • Leads tableNew
  • Sign in
Pages10
  • ASCII workspace$49
  • CRM overviewNew
  • Marketing dashboardNew
  • Developer portfolio$49
  • Particle landing$49
  • Particle story$49
  • Statement converter$49
  • AI photo studio$49
  • Group card launch$49
  • Month-end storyNew
Themes9
  • Default
  • Ember
  • Ocean
  • Forest
  • Grape
  • Rose
  • Amber
  • Clay
  • Brutal
Upgrade
nextui.dev

nextui components, blocks and themes you install with one command.

Product

  • Components
  • Blocks
  • Themes
  • Pricing

Resources

  • Docs
  • Roadmap
  • GitHub

Legal

  • License
  • Privacy
  • Terms
  • Refunds

nextUI

[ 200 OK ] · nextUI

© 2026 NEXTUI • All rights reserved.

Upgrade
ComponentsAI & agentsTool call
Copy promptCopy prompt

Customize

Tool name in the header; read from part.type when you pass part

Where the call is: arguments streaming, running, done or failed

Message shown when state is output-error

Time the call took in ms, shown as “Done · 1.2s”

1240ms

Loop a scripted call while on screen, for demos

Starting expanded state when uncontrolled

JSX · copied with Copy prompt

<ToolCall autoPlay />

Tool callNew

Collapsible card for one AI agent tool call: the arguments stream in, a status pill shimmers while it runs, then the result slides in. Takes a Vercel AI SDK tool part as is.

Installation

Set your access key from API keys as NEXTUI_TOKEN in .env.local and add the @nextui namespace below to components.json once. Then every item installs by name. Each install counts as a copy on a free account.

$pnpm dlx shadcn@latest add @nextui/tool-call
1{
2 "registries": {
3 "@nextui": {
4 "url": "https://nextui.dev/r/{name}.json",
5 "headers": { "Authorization": "Bearer ${NEXTUI_TOKEN}" }
6 }
7 }
8}

Usage

1"use client";
2
3import { useChat } from "@ai-sdk/react";
4import { ToolCall } from "@/components/nextui/tool-call";
5
6export function Messages() {
7 const { messages } = useChat();
8
9 return messages.map((message) =>
10 message.parts.map((part, i) =>
11 part.type.startsWith("tool-") ? (
12 // Pass the AI SDK tool part as is: name, state, input and output come from it.
13 <ToolCall key={i} part={part as never} />
14 ) : part.type === "text" ? (
15 <p key={i}>{part.text}</p>
16 ) : null,
17 ),
18 );
19}
20
21// Or drive it yourself, without the AI SDK:
22// <ToolCall name="get_weather" state="output-available" input={{ city: "Hanoi" }} output={{ tempC: 29 }} duration={840} />

API reference

Edit props live in the preview above, or see all 12 props
PropTypeDefaultDescription
partToolPartLike–A Vercel AI SDK tool part (type, state, input, output, errorText); fills the props below
namestring"search_web"Tool name in the header; read from part.type when you pass part
state"input-streaming" | "input-available" | "output-available" | "output-error""output-available"Where the call is: arguments streaming, running, done or failed
inputunknown–Arguments the model sent; objects show as formatted JSON
outputunknown–What the tool returned; objects show as JSON, elements render as they are
errorTextstring–Message shown when state is output-error
durationnumber–Time the call took in ms, shown as “Done · 1.2s”
autoPlaybooleanfalseLoop a scripted call while on screen, for demos
openboolean–Controlled expanded state
defaultOpenbooleantrueStarting expanded state when uncontrolled
onOpenChange(open: boolean) => void–Called when the header is clicked
classNamestring–Extra classes on the wrapper

Related

All components

Chat inputNew

Task checklistNew

ReasoningNew

Sign in to see the code

Preview it freely. A free account copies code and prompts a few times a day.

Sign in