Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

Agent for Vue

An agent's setup on one card: its name and model, its instructions, and tools that open into their schemas. For Vue with Ark UI, before it runs.

UI library: Ark UI

One card says what an agent is: its name and model, the instructions it runs on, the tools it can call and what it returns.

Use it where people build, review or pick agents: a settings page, a team of agents side by side, the docs for an agent you ship. Each tool is a row that opens into its input schema, and the schemas show in a Code Block. Agent shows the setup before anything runs; Subagent shows a run that already happened, its tool calls and what it found. In Vue, Ark UI runs the tool list, so its rows open from the keyboard.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

The install adds Accordion for the tools, Badge for the model, and Code Block with its highlighter for the schemas.

Anatomy

Agent anatomy: root, header, instructions, tools, tool, output
Agent
├── AgentHeader (its name and model)
└── AgentContent
    ├── AgentInstructions
    ├── AgentTools
    │   └── AgentTool (one per tool, opens into its schema)
    └── AgentOutput

Usage

<script setup lang="ts">
import {
  Agent, AgentContent, AgentHeader, AgentInstructions, AgentOutput,
  AgentTool, AgentTools,
} from "@/components/ui/agent";
</script>
<Agent>
  <AgentHeader model="gpt-4o" name="Research Assistant" />
  <AgentContent>
    <AgentInstructions>Search the web and cite every source.</AgentInstructions>
    <AgentTools>
      <AgentTool
        tool={{
          description: "Search the web",
          jsonSchema: { properties: { query: { type: "string" } }, type: "object" },
        }}
        value="search"
      />
    </AgentTools>
    <AgentOutput schema="interface Result { answer: string }" />
  </AgentContent>
</Agent>

Accessibility

Tab
Moves focus to the next tool's row, then into an open schema and its copy button.
Enter
Opens or closes the focused tool.
Space
Opens or closes the focused tool.
  • Each tool's row is a button with aria-expanded, and its description is the button's name.
  • A schema scrolls inside its block, and the block can take focus, so a long schema scrolls from the keyboard. Its copy button shows on focus as well as on hover.
  • Schemas always read left to right. The card itself follows the page direction.
  • The bot icon is hidden from assistive tech: the name says which agent it is.

Demos

Controlled

Three tools of a support agent, one open, with an Expand all button in the header. AgentTools takes the props of Ark UI's accordion, so the demo keeps which tools are open and sets them all at once. Whatever you pass as children to AgentHeader goes after the name, here the button. Open a tool from code when the reader came to see that one, from a link or a failed call.

Preview width

Team

Three agents in a column, each with its model and the number of tools it has. A card without AgentTools or AgentOutput shows only what it has, here the instructions. Use it to compare agents that share a task, such as a researcher, a writer and a reviewer. Keep each one's instructions short enough to read in the card.

Preview width

AI SDK Tools

Two tools written the way the AI SDK writes them, description and an inputSchema wrapped by jsonSchema(), and an output schema in JSON. AgentTool reads jsonSchema, then inputSchema, and unwraps the helper's wrapper, so a tools record renders as it is. language on AgentOutput sets its highlighting: TypeScript by default, json here.

Preview width

AI SDK

A tool from the AI SDK's tool() is a description and an input schema, which is what AgentTool takes. Map the record you hand the model, keyed by name:

A tool definition is data, so it needs no AI SDK package in Vue: pass each tool's description and its JSON Schema to AgentTool's tool, as the AI SDK Tools demo does.

A Zod schema isn't JSON Schema yet: convert it first, with z.toJSONSchema(schema) in Zod 4, and pass the result as jsonSchema. Show the model id you pass to the provider in AgentHeader's model, and the system prompt in AgentInstructions.

Migrating from AI SDK Elements

AI SDK Elements is for React. In Vue, Agent has the same parts and props, so its demos are the place to start.

FAQ

How do I list an agent's tools in Vue?

Put one AgentTool per tool inside AgentTools, each with a unique value and a tool object. The row shows the tool's description, or No description, and opens into its input schema as JSON in a Code Block. Several tools can be open at once. AgentTool reads jsonSchema first, then inputSchema.

Can I pass AI SDK tools to Agent?

Yes. A tool made with the AI SDK's tool() has a description and an inputSchema, which is what AgentTool reads, and the wrapper that jsonSchema() adds is unwrapped for you. A Zod schema has to become JSON Schema first, with z.toJSONSchema in Zod 4, or the block shows Zod's internals instead of the fields.

What is the difference between Agent and Subagent?

Agent is the setup: the model, the instructions, the tools it may call and what it returns, before it runs. Subagent is a run: one line in a reply that opens into the calls a subagent made and what it found. Show Agent in settings and docs, and Subagent in the conversation.

How do I show what an agent returns?

Pass the schema as text to AgentOutput's schema prop: a TypeScript interface, a JSON Schema, or the source of a Zod schema. It's highlighted as TypeScript unless you set language, such as json. A long schema scrolls inside its block, and the copy button copies all of it.

How do I open a tool from code?

Control AgentTools as an accordion, from the open tools' values, as the Controlled demo on this page does.

Open the tool a link points at, or the one whose call failed, rather than all of them.

How do I style an Agent with Ark UI?

Edit the agent file under components/ui. Every part has its own data-slot, from agent and agent-header to agent-tool and agent-output, and the model badge is agent-model. The tool rows are your accordion, and the schemas are Code Blocks, so their styles come from those files. Pass className to any part for a one-off change.

How do I install Agent in Vue?

Run the command in the Installation section on this page. It adds the agent file, Accordion, Badge, Code Block and the highlighter the schemas use, so the demos work as soon as they're pasted. The command uses the shadcn-vue CLI.

API Reference

Agent

<div> data-slot="agent"

PropType
class?string

Merged with the part's classes.

AgentHeader

<div> data-slot="agent-header"

PropType
namestring

The agent's name.

model?string

The model it runs on, shown as a badge after its name.

class?string

Merged with the part's classes.

AgentContent

<div> data-slot="agent-content"

PropType
class?string

Merged with the part's classes.

AgentInstructions

<div> data-slot="agent-instructions"

PropType
childrenstring

The system prompt.

label?string

The heading above it.

Default
"Instructions"
class?string

Merged with the part's classes.

AgentTools

<div> data-slot="agent-tools"

PropType
value?string[]

The controlled value of the expanded accordion items. Two-way with v-model.

defaultValue?string[]

The initial value of the expanded accordion items. Use when you don't need to control the value of the accordion.

collapsible?boolean

Whether an accordion item can be closed after it has been expanded.

Default
false
dir?"ltr" | "rtl"

The document's text/writing direction.

Type
"ltr" | "rtl"
Default
"ltr"
disabled?boolean

Whether the accordion items are disabled.

hideMode?"display-none" | "activity"

How to hide content when mounted but not present. - display-none: HTML hidden attribute. Effects stay alive. - activity: React 19 <Activity mode="hidden">. Effects pause. Requires React 19+.

Type
"display-none" | "activity"
Default
"display-none"
id?string

The unique identifier of the machine.

ids?object

The ids of the elements in the accordion. Useful for composition.

Type
{ root?: string; item?: (value: string) → string; itemContent?: (value: string) → string; itemTrigger?: (value: string) → string }
label?string

The heading above the list.

Default
"Tools"
lazyMount?boolean

Whether to enable lazy mounting.

Default
false
multiple?boolean

Whether multiple accordion items can be expanded at the same time. Ark default: false.

Default
true
orientation?"horizontal" | "vertical"

The orientation of the accordion items.

Type
"horizontal" | "vertical"
Default
"vertical"
unmountOnExit?boolean

Whether to unmount on exit.

Default
false
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

class?string

Merged with the part's classes.

EventType
@value-change(details: ValueChangeDetails) → void

The callback fired when the state of expanded/collapsed accordion items changes.

Type
(details: ValueChangeDetails) → void
Parameters

details – { value: string[] }

Returns
void
@focus-change(details: FocusChangeDetails) → void

The callback fired when the focused accordion item changes.

Type
(details: FocusChangeDetails) → void
Parameters

details – { value: string | null }

Returns
void

AgentTool

data-slot="agent-tool"

PropType
toolobject

The tool: its description is the row, its input schema the panel.

Type
{ description?: string; inputSchema?: unknown; jsonSchema?: unknown }
valuestring

The value of the accordion item.

disabled?boolean

Whether the accordion item is disabled.

asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

class?string

Merged with the part's classes.

AgentOutput

<div> data-slot="agent-output"

PropType
schemastring

What the agent returns: a type or a JSON Schema, as text.

label?string

The heading above it.

Default
"Output Schema"
language?string

The language the schema is highlighted in.

Default
"typescript"
class?string

Merged with the part's classes.