Tool
A collapsible tool invocation inspector with directional-swap status badges, runtime duration readouts, JSON input formatting, and output/error panels.
{
"query": "motion-tokens",
"category": "ai",
"limit": 4
}{
"matches": 4,
"topResult": "reasoning",
"status": "ready"
}Customize
Installation
npx shadcn@latest add @kinetic/toolUsage
Compose Tool, ToolHeader, ToolContent, ToolInput, and ToolOutput to show live agent tool invocations.
import {
Tool,
ToolContent,
ToolHeader,
ToolInput,
ToolOutput,
} from "@/components/kinetic/ui/tool";
export function SearchToolCall() {
return (
<Tool defaultOpen state="output-available">
<ToolHeader title="search_docs" type="tool-search" durationMs={165} />
<ToolContent>
<ToolInput input={{ query: "motion-prefs", limit: 3 }} />
<ToolOutput output={{ count: 3, ok: true }} />
</ToolContent>
</Tool>
);
}Execution states
Tool supports seven states: input-streaming, input-available, approval-requested, approval-responded, output-available, output-error, and output-denied. Status labels animate transitions with directionalSwap, show a status dot or Spinner while running, draw a check stroke on output-available, and apply a subtle shake when transitioning to output-error or output-denied.
import type { ToolState } from "@/components/kinetic/ui/tool";
interface ToolCardProps {
readonly state: ToolState;
readonly errorText?: string;
}
export function ToolCard({ state, errorText }: ToolCardProps) {
return (
<Tool state={state} defaultOpen>
<ToolHeader title="fetch_schema" />
<ToolContent>
<ToolInput input={{ endpoint: "/r/registry.json" }} />
<ToolOutput errorText={errorText} />
</ToolContent>
</Tool>
);
}Motion preferences
Pass animated={false}, speed (0.45 default), or blurPx (8 default) on Tool. Reduced motion disables status shakes, spinners, and height springs cleanly.
API Reference
Tool
Zero-dependency collapsible tool inspector with spring height morph, directional status swaps, drawStroke checkmarks, and error shake.
| Prop | Type | Default | Description |
|---|---|---|---|
open / defaultOpen / onOpenChange | boolean / boolean / (open: boolean) => void | false | Controlled or initial expanded state. |
state | ToolState | - | Execution state driving the status label, Spinner, stroke check, or error shake. |
animated / speed / blurPx / disabled | boolean / number / number / boolean | true / 0.45 / 8 / false | Toggles animations, scales timing, sets reveal blur (px), and locks toggling. |
ToolHeader / ToolContent / ToolInput / ToolOutput
Status-animated header button, height-morphed body, formatted JSON parameters, and directional-swap error output.
| Prop | Type | Default | Description |
|---|---|---|---|
title / type / durationMs (ToolHeader) | React.ReactNode / string / number | - | Tool display name, type slug, and formatted runtime duration badge. |
input (ToolInput) | unknown | - | Arguments formatted cleanly inside a scrollable monospace pre block. |
output / errorText (ToolOutput) | unknown / React.ReactNode | - | Result node or JSON payload and optional alert banner animated with directionalSwap. |