Tool

The Tool component displays a collapsible interface for showing and hiding tool details from AI SDK tool parts.

Tool Components Example

Installation

pnpm dlx shadcn-svelte@latest add https://svelte-ai-elements.vercel.app/r/tool.json

If you prefer using jsrepo, please install via the command below:

pnpm dlx jsrepo add @ai/elements/ai-elements/tool

Props

Tool

NameTypeDefault
class
string
children
Snippet
...restProps
CollapsibleProps

ToolHeader

NameTypeDefault
type
string
state
'input-streaming' | 'input-available' | 'output-available' | 'output-error'
class
string
...restProps
CollapsibleTriggerProps

ToolInput

NameTypeDefault
input
any
class
string
...restProps
HTMLAttributes<HTMLDivElement>

ToolOutput

NameTypeDefault
output
any
errorText
string
class
string
children
Snippet
...restProps
HTMLAttributes<HTMLDivElement>

ToolContent

NameTypeDefault
class
string
children
Snippet
...restProps
CollapsibleContentProps