- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Trace
- Typography
October 2026 - Trace, Code Block and AI Elements
Two new components for the steps an agent takes and the code it writes, and AI Elements, patterns for agentic interfaces built from shadcn/ui components.
Today, we are releasing two new components, Trace and Code Block, and AI Elements, a set of patterns for agentic interfaces built from shadcn/ui components.
Trace and Code Block are available for Base UI, React Aria and Radix across all eight styles.
Trace#
Trace is a list of lines for the steps an agent takes. We built it by studying hundreds of components from agentic interfaces and distilling what they share into one composition you can reuse.
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)The last commit bumped a version in package.json without updating pnpm-lock.yaml, so the frozen install fails. Run pnpm install locally and commit the lockfile.
"use client"
import * as React from "react""use client"
import * as React from "react"
import { useChat } from "@ai-sdk/react"
import type { UIDataTypes, UIMessage } from "ai"
import {
ArrowUpRightIcon,
CircleAlertIcon,
CircleCheckIcon,
GlobeIcon,
LoaderCircleIcon,
} from "lucide-react"
import { createChat, getMessageText } from "@/lib/ai"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Button } from "@/components/ui/button"
import { CodeBlock, CodeBlockContent } from "@/components/ui/code-block"
import { Message, MessageContent } from "@/components/ui/message"
import {
Trace,
TraceCollapsible,
TraceCollapsibleContent,
TraceCollapsibleTrigger,
TraceIcon,
TraceLine,
TraceTitle,
} from "@/components/ui/trace"
type ChatMessage = UIMessage<
unknown,
UIDataTypes,
{
runCommand: {
input: { command: string }
output: { stdout: string }
}
}
>
type Part = ChatMessage["parts"][number]
const chat = createChat<ChatMessage>()
.user("Why does pnpm install fail in CI?")
.assistant(({ writer }) => {
writer.reasoning(
"CI installs with a frozen lockfile, so the install stops when package.json and pnpm-lock.yaml disagree. I should check what the last commit changed, then reproduce the install.",
{ delayMs: 40 }
)
writer
.tool("runCommand", { input: { command: "pnpm --version" } })
.sleep(700)
.output({ stdout: "10.18.0" })
writer
.tool("runCommand", {
input: {
command: "git diff --stat HEAD~1 -- package.json pnpm-lock.yaml",
},
})
.sleep(900)
.output({
stdout:
" package.json | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)",
})
writer
.tool("runCommand", {
input: { command: "pnpm install --frozen-lockfile" },
})
.sleep(1200)
.error(
'ERR_PNPM_OUTDATED_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json'
)
writer.sourceUrl({
url: "https://pnpm.io/cli/install#--frozen-lockfile",
title: "pnpm install | pnpm.io",
})
writer.sourceUrl({
url: "https://pnpm.io/continuous-integration",
title: "Continuous Integration | pnpm.io",
})
writer.sleep(1000)
writer.text(
"The last commit bumped a version in package.json without updating pnpm-lock.yaml, so the frozen install fails. Run pnpm install locally and commit the lockfile."
)
})
const transcript = chat.get()
const [question] = chat.get(1)
const transport = chat.transport({ delayMs: 20 })
function ThinkingRow({ text, running }: { text: string; running: boolean }) {
const [open, setOpen] = React.useState<boolean>()
const line = (
<TraceLine status={running ? "running" : undefined}>
<TraceIcon>
{running ? (
<LoaderCircleIcon className="animate-spin" />
) : (
<CircleCheckIcon />
)}
</TraceIcon>
<TraceTitle>{running ? "Thinking" : "Thought for 5s"}</TraceTitle>
</TraceLine>
)
if (text.length === 0) {
return line
}
return (
<TraceCollapsible open={open ?? running} onOpenChange={setOpen}>
<TraceCollapsibleTrigger>{line}</TraceCollapsibleTrigger>
<TraceCollapsibleContent className="whitespace-pre-wrap">
{text}
</TraceCollapsibleContent>
</TraceCollapsible>
)
}
function ToolRow({
part,
streaming,
defaultOpen,
}: {
part: Extract<Part, { type: "tool-runCommand" }>
streaming: boolean
defaultOpen?: boolean
}) {
const command = part.input?.command
if (part.state === "output-available" || part.state === "output-error") {
const failed = part.state === "output-error"
return (
<TraceCollapsible defaultOpen={defaultOpen}>
<TraceCollapsibleTrigger>
<TraceLine status={failed ? "error" : undefined}>
<TraceIcon>
{failed ? <CircleAlertIcon /> : <CircleCheckIcon />}
</TraceIcon>
<TraceTitle>
{failed ? "Failed to run" : "Ran"} {command}
</TraceTitle>
</TraceLine>
</TraceCollapsibleTrigger>
<TraceCollapsibleContent>
{failed ? (
<CodeBlock size="sm" variant="destructive">
<CodeBlockContent wrap className="max-h-64">
{part.errorText}
</CodeBlockContent>
</CodeBlock>
) : (
<CodeBlock size="sm">
<CodeBlockContent wrap className="max-h-64">
{part.output.stdout}
</CodeBlockContent>
</CodeBlock>
)}
</TraceCollapsibleContent>
</TraceCollapsible>
)
}
return (
<TraceLine status={streaming ? "running" : "error"}>
<TraceIcon>
{streaming ? (
<LoaderCircleIcon className="animate-spin" />
) : (
<CircleAlertIcon />
)}
</TraceIcon>
<TraceTitle>
{streaming ? "Running" : "Failed to run"} {command}
</TraceTitle>
</TraceLine>
)
}
function SourcesRow({
sources,
running,
}: {
sources: Extract<Part, { type: "source-url" }>[]
running: boolean
}) {
return (
<TraceCollapsible>
<TraceCollapsibleTrigger>
<TraceLine status={running ? "running" : undefined}>
<TraceIcon>
{running ? (
<LoaderCircleIcon className="animate-spin" />
) : (
<GlobeIcon />
)}
</TraceIcon>
<TraceTitle>
{running ? "Using" : "Used"} {sources.length} sources
</TraceTitle>
</TraceLine>
</TraceCollapsibleTrigger>
<TraceCollapsibleContent>
<Trace>
{sources.map((source) => (
<a
key={source.url}
href={source.url}
target="_blank"
rel="noreferrer"
>
<TraceLine>
<TraceIcon>
<GlobeIcon />
</TraceIcon>
<TraceTitle>
{source.title ?? new URL(source.url).hostname}
<span className="sr-only"> (opens in a new tab)</span>
</TraceTitle>
<TraceIcon>
<ArrowUpRightIcon />
</TraceIcon>
</TraceLine>
</a>
))}
</Trace>
</TraceCollapsibleContent>
</TraceCollapsible>
)
}
export function TraceDemo() {
const { messages, sendMessage, setMessages, status } = useChat({
messages: transcript,
transport,
})
const busy = status === "submitted" || status === "streaming"
return (
<div className="flex min-h-72 w-full max-w-sm flex-col gap-4 py-6 text-sm">
{messages.map((message) => {
if (message.role === "user") {
return (
<Message key={message.id} align="end">
<MessageContent>
<Bubble align="end" variant="muted">
<BubbleContent>{getMessageText(message)}</BubbleContent>
</Bubble>
</MessageContent>
</Message>
)
}
const streaming = busy && message === messages.at(-1)
const rows = message.parts.filter(
(part) => part.type === "reasoning" || part.type === "tool-runCommand"
)
const sources = message.parts.filter(
(part) => part.type === "source-url"
)
const text = getMessageText(message)
return (
<Message key={message.id}>
<MessageContent className="gap-4">
{rows.length + sources.length > 0 && (
<Trace>
{rows.map((part, index) =>
part.type === "reasoning" ? (
<ThinkingRow
key={index}
text={part.text}
running={streaming && part.state === "streaming"}
/>
) : part.type === "tool-runCommand" ? (
<ToolRow
key={part.toolCallId}
part={part}
streaming={streaming}
defaultOpen={index === 2}
/>
) : null
)}
{sources.length > 0 && (
<SourcesRow
sources={sources}
running={streaming && text.length === 0}
/>
)}
</Trace>
)}
{text && <p>{text}</p>}
</MessageContent>
</Message>
)
})}
{!busy && (
<Button
variant="outline"
size="sm"
className="mt-auto self-start"
onClick={() => {
setMessages([])
sendMessage(question)
}}
>
Replay
</Button>
)}
</div>
)
}
Reasoning, tool calls, sources, plans and subagent runs all have the same shape: something the agent did, and what happened. In Trace, each one is a line with an icon, a title, and an optional description and status. A line can expand to show more detail, link to a page, or open a dialog or sheet, so every step looks and behaves the same in your interface.
running,errorandpendingstates, with a shimmer while a step runs.- Lines that expand, link out, or open a dialog, sheet, drawer or popover.
- Nested lines, so a summary expands into steps and a step into its output.
- Works with the reasoning, tool and source parts from the AI SDK.
- Keyboard and screen reader support from the trigger that wraps each line.
pnpm dlx shadcn@latest add trace
Code Block#
CodeBlock displays code, terminal output, logs and diffs. It has a header with a title and actions, line numbers, wrapping, diff and highlighted lines, and a small size for tool output in a Trace.
import { streamText } from "ai"
export async function POST(request: Request) { const { messages } = await request.json()
const result = streamText({ model: "anthropic/claude-sonnet-4.5", system: "You are a helpful assistant. Answer in one short paragraph.", messages, })
return result.toUIMessageStreamResponse()}"use client"
import * as React from "react""use client"
import * as React from "react"
import { DownloadIcon, FileCodeIcon, WrapTextIcon } from "lucide-react"
import { useHighlightedCode } from "@/hooks/use-highlighted-code"
import { Button } from "@/components/ui/button"
import {
CodeBlock,
CodeBlockActions,
CodeBlockContent,
CodeBlockCopyButton,
CodeBlockHeader,
CodeBlockLine,
CodeBlockTitle,
} from "@/components/ui/code-block"
const code = `import { streamText } from "ai"
export async function POST(request: Request) {
const { messages } = await request.json()
const result = streamText({
model: "anthropic/claude-sonnet-4.5",
system: "You are a helpful assistant. Answer in one short paragraph.",
messages,
})
return result.toUIMessageStreamResponse()
}`
function download(value: string, filename: string) {
const url = URL.createObjectURL(new Blob([value], { type: "text/plain" }))
const link = document.createElement("a")
link.href = url
link.download = filename
link.click()
URL.revokeObjectURL(url)
}
export function CodeBlockDemo() {
const [wrap, setWrap] = React.useState(false)
const lines = useHighlightedCode(code, "ts")
return (
<div className="w-full max-w-lg">
<CodeBlock>
<CodeBlockHeader>
<CodeBlockTitle>
<FileCodeIcon />
app/api/chat/route.ts
</CodeBlockTitle>
<CodeBlockActions>
<Button
variant="ghost"
size="icon-xs"
aria-label="Wrap lines"
aria-pressed={wrap}
className="aria-pressed:text-foreground"
onClick={() => setWrap(!wrap)}
>
<WrapTextIcon />
</Button>
<Button
variant="ghost"
size="icon-xs"
aria-label="Download"
onClick={() => download(code, "route.ts")}
>
<DownloadIcon />
</Button>
<CodeBlockCopyButton value={code} />
</CodeBlockActions>
</CodeBlockHeader>
<CodeBlockContent wrap={wrap} lineNumbers>
{lines.map((line, index) => (
<CodeBlockLine
key={index}
variant={index >= 5 && index <= 9 ? "highlighted" : "default"}
>
{line}
</CodeBlockLine>
))}
</CodeBlockContent>
</CodeBlock>
</div>
)
}
pnpm dlx shadcn@latest add code-block
Building agentic interfaces#
Trace and Code Block join the components for chat interfaces we released in June. Together, they cover every part of an agentic interface:
- Message Scroller holds the thread. It anchors each turn, follows the reply while it streams and loads history without jumping.
- Message is one turn, with an avatar, a header and a footer for actions.
- Bubble holds what the person sends.
- Trace shows the steps the agent takes inside a turn.
- Code Block shows the code, commands and output those steps produce.
- Marker adds notes and dividers between turns.
- Attachment shows the files that come with a message.
- Questionnaire asks the person to clarify before the agent continues.
AI Elements#
AI Elements are patterns for agentic interfaces built from these components. There is no package to install. Each pattern is a composition you copy into your project, and the code is yours.
"use client"
import * as React from "react""use client"
import * as React from "react"
import { useChat } from "@ai-sdk/react"
import type { UIDataTypes, UIMessage } from "ai"
import {
ArrowUpIcon,
CircleCheckIcon,
GlobeIcon,
LoaderCircleIcon,
MessageCircleDashedIcon,
PaperclipIcon,
PlusIcon,
RotateCwIcon,
TelescopeIcon,
TerminalIcon,
} from "lucide-react"
import { motion, useReducedMotion } from "motion/react"
import { createChat, getMessageText } from "@/lib/ai"
import { MESSAGE_ANIMATIONS } from "@/lib/message-animations"
import { Markdown } from "@/components/markdown"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Button } from "@/components/ui/button"
import { CodeBlock, CodeBlockContent } from "@/components/ui/code-block"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import {
Empty,
EmptyDescription,
EmptyHeader,
EmptyMedia,
EmptyTitle,
} from "@/components/ui/empty"
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupTextarea,
} from "@/components/ui/input-group"
import { Message, MessageContent } from "@/components/ui/message"
import {
MessageScroller,
MessageScrollerButton,
MessageScrollerContent,
MessageScrollerItem,
MessageScrollerProvider,
MessageScrollerViewport,
} from "@/components/ui/message-scroller"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip"
import {
Trace,
TraceCollapsible,
TraceCollapsibleContent,
TraceCollapsibleTrigger,
TraceIcon,
TraceLine,
TraceTitle,
} from "@/components/ui/trace"
type ChatMessage = UIMessage<
unknown,
UIDataTypes,
{
runCommand: {
input: { command: string }
output: { stdout: string }
}
}
>
type ChatPart = ChatMessage["parts"][number]
type ToolPart = Extract<ChatPart, { type: "tool-runCommand" }>
const chat = createChat<ChatMessage>()
.user("Add a dark mode toggle to the settings page.")
.sleep(600)
.assistant(({ writer }) => {
writer.reasoning(
"I need to know how themes are set up before I add a toggle. If next-themes is already in the layout, the toggle only has to call setTheme."
)
writer.sleep(400)
writer
.tool("runCommand", { input: { command: "rg -l ThemeProvider app" } })
.sleep(800)
.output({ stdout: "app/layout.tsx" })
writer.sleep(500)
writer.text(`next-themes is already set up in \`app/layout.tsx\`, so the toggle only has to call \`setTheme\`.
**Changes**
- Added \`components/mode-toggle.tsx\` with a Light and Dark option.
- Put \`<ModeToggle />\` next to the Appearance heading in \`app/settings/page.tsx\`.
\`\`\`tsx
const { setTheme } = useTheme()
\`\`\`
`)
})
.user("Make it follow the system setting by default.")
.sleep(600)
.assistant(({ writer }) => {
writer.reasoning(
"The default theme lives on the ThemeProvider. I should check what it is set to now."
)
writer.sleep(400)
writer
.tool("runCommand", {
input: { command: "rg -n defaultTheme app/layout.tsx" },
})
.sleep(800)
.output({
stdout: '12: <ThemeProvider attribute="class" defaultTheme="light">',
})
writer.sleep(500)
writer.text(`It was set to \`light\`. I updated the \`ThemeProvider\` in \`app/layout.tsx\`:
\`\`\`tsx
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
\`\`\`
New visitors now get the theme from their OS. The toggle also has a **System** option, so anyone who picked Light or Dark can switch back.
`)
})
.user("Run the build before I ship it.")
.sleep(600)
.assistant(({ writer }) => {
writer
.tool("runCommand", { input: { command: "pnpm build" } })
.sleep(1600)
.output({
stdout:
"▲ Next.js 16.0.0\n\n✓ Compiled successfully in 4.2s\n✓ Linting and checking validity of types\n✓ Generating static pages (12/12)",
})
writer.sleep(500)
writer.text(`The build passes, so it is ready to ship.
- Compiled in **4.2s**.
- No lint or type errors.
- Generated all **12** static pages.
`)
})
const initialMessages = chat.get(0)
const transport = chat.transport({
delayMs: 16,
fallback:
"This demo only knows the scripted turns. Press reset to start over.",
})
const MotionMessageScrollerItem = motion.create(MessageScrollerItem)
export function ChatDemo() {
const { messages, sendMessage, setMessages, status } = useChat({
messages: initialMessages,
transport,
})
const [draft, setDraft] = React.useState<string | null>(null)
const formRef = React.useRef<HTMLFormElement>(null)
const shouldReduceMotion = useReducedMotion()
const nextMessage = chat.next(messages)
const busy = status === "submitted" || status === "streaming"
const text = draft ?? (nextMessage ? getMessageText(nextMessage) : "")
const canSend = text.trim().length > 0 && !busy
function onSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
if (!canSend) {
return
}
if (draft === null && nextMessage) {
void sendMessage(nextMessage)
} else {
void sendMessage({ text: text.trim() })
}
setDraft(null)
}
return (
<MessageScrollerProvider>
<div className="relative flex w-full flex-col gap-4 [[data-slot=preview]:has(&)]:bg-background [[data-slot=preview]:has(&)>div]:p-0!">
<div className="flex h-200 w-full flex-col gap-4">
<div className="flex items-start justify-between gap-4 p-8 pb-4">
<div className="flex flex-col gap-1">
<div className="font-medium">New Thread</div>
<div className="text-sm text-muted-foreground">
Ask the agent to change your code.
</div>
</div>
<Tooltip>
<TooltipTrigger render={<Button variant="outline" size="icon" aria-label="Reset conversation" onClick={() => {
setMessages(initialMessages)
setDraft(null)
}} disabled={busy}><RotateCwIcon /></Button>} />
<TooltipContent>
<p>Reset</p>
</TooltipContent>
</Tooltip>
</div>
<div className="min-h-0 flex-1">
{messages.length === 0 ? (
<Empty className="h-full">
<EmptyHeader>
<EmptyMedia variant="icon">
<MessageCircleDashedIcon />
</EmptyMedia>
<EmptyTitle>What should we build?</EmptyTitle>
<EmptyDescription>
The agent can read your code, run commands and make changes.
Press send to start.
</EmptyDescription>
</EmptyHeader>
</Empty>
) : (
<MessageScroller>
<MessageScrollerViewport>
<MessageScrollerContent
aria-busy={busy}
className="gap-6 px-8 py-0"
>
{messages.map((message) => {
if (message.role === "user") {
return (
<MotionMessageScrollerItem
key={message.id}
messageId={message.id}
scrollAnchor
variants={MESSAGE_ANIMATIONS["slide-up"].variants}
initial={shouldReduceMotion ? false : "initial"}
animate="animate"
>
<Message align="end">
<MessageContent>
<Bubble align="end" variant="muted">
<BubbleContent>
{getMessageText(message)}
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</MotionMessageScrollerItem>
)
}
const streaming = busy && message === messages.at(-1)
const steps = message.parts.filter(
(part) =>
part.type === "reasoning" ||
part.type === "tool-runCommand"
)
const reply = getMessageText(message)
return (
<MessageScrollerItem
key={message.id}
messageId={message.id}
>
<Message>
<MessageContent className="gap-3">
{steps.length > 0 && (
<Trace>
{steps.map((part, index) => (
<StepRow
key={index}
part={part}
streaming={streaming}
/>
))}
</Trace>
)}
{reply && <Markdown>{reply}</Markdown>}
</MessageContent>
</Message>
</MessageScrollerItem>
)
})}
</MessageScrollerContent>
</MessageScrollerViewport>
<MessageScrollerButton />
</MessageScroller>
)}
</div>
<div className="p-8 pt-0">
<form ref={formRef} onSubmit={onSubmit} className="w-full">
<InputGroup>
<InputGroupTextarea
value={text}
onChange={(event) => setDraft(event.target.value)}
placeholder="Ask the agent..."
aria-label="Message"
className="min-h-14"
onKeyDown={(event) => {
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault()
formRef.current?.requestSubmit()
}
}}
/>
<InputGroupAddon align="block-end" className="pt-1">
<DropdownMenu>
<DropdownMenuTrigger render={<InputGroupButton aria-label="Add context" type="button" size="icon-sm" variant="outline"><PlusIcon /></InputGroupButton>} />
<DropdownMenuContent
align="start"
side="top"
className="w-44"
>
<DropdownMenuItem>
<PaperclipIcon />
Add Photos & Files
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem>
<TelescopeIcon />
Deep Research
</DropdownMenuItem>
<DropdownMenuItem>
<GlobeIcon />
Web Search
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<InputGroupButton
type="submit"
variant="default"
size="icon-sm"
disabled={!canSend}
className="ml-auto"
>
<ArrowUpIcon />
<span className="sr-only">Send</span>
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
</form>
</div>
</div>
</div>
</MessageScrollerProvider>
)
}
function StepRow({ part, streaming }: { part: ChatPart; streaming: boolean }) {
if (part.type === "reasoning") {
return (
<ReasoningRow text={part.text} running={part.state === "streaming"} />
)
}
if (part.type === "tool-runCommand") {
return <ToolRow part={part} streaming={streaming} />
}
return null
}
function ReasoningRow({ text, running }: { text: string; running: boolean }) {
const [open, setOpen] = React.useState<boolean>()
return (
<TraceCollapsible open={open ?? running} onOpenChange={setOpen}>
<TraceCollapsibleTrigger>
<TraceLine status={running ? "running" : undefined}>
<TraceIcon>
{running ? (
<LoaderCircleIcon className="animate-spin" />
) : (
<CircleCheckIcon />
)}
</TraceIcon>
<TraceTitle>{running ? "Thinking" : "Thought"}</TraceTitle>
</TraceLine>
</TraceCollapsibleTrigger>
<TraceCollapsibleContent className="whitespace-pre-wrap">
{text}
</TraceCollapsibleContent>
</TraceCollapsible>
)
}
function ToolRow({ part, streaming }: { part: ToolPart; streaming: boolean }) {
const command = part.input?.command
if (part.state === "output-available" || part.state === "output-error") {
const failed = part.state === "output-error"
return (
<TraceCollapsible>
<TraceCollapsibleTrigger>
<TraceLine status={failed ? "error" : undefined}>
<TraceIcon>
<TerminalIcon />
</TraceIcon>
<TraceTitle>
{failed ? "Failed to run" : "Ran"} {command}
</TraceTitle>
</TraceLine>
</TraceCollapsibleTrigger>
<TraceCollapsibleContent>
<CodeBlock size="sm">
<CodeBlockContent wrap className="max-h-64">
{failed ? part.errorText : part.output.stdout}
</CodeBlockContent>
</CodeBlock>
</TraceCollapsibleContent>
</TraceCollapsible>
)
}
return (
<TraceLine status={streaming ? "running" : "error"}>
<TraceIcon>
<TerminalIcon />
</TraceIcon>
<TraceTitle>
{streaming ? "Running" : "Failed to run"} {command}
</TraceTitle>
</TraceLine>
)
}
There are 21 patterns, from Chat and Prompt Input to Reasoning, Tool, Plan and Subagent. Each page shows how to render the pattern from AI SDK message parts.
Every page is also available as Markdown, so you can point your coding agent at it:
Add the Reasoning pattern from https://ui.shadcn.com/docs/ai-elements/base/reasoning.md to my chat.Migrating from AI SDK Elements#
AI Elements replaces AI SDK Elements, and we are going to deprecate AI SDK Elements.
You do not need to migrate right away. The components you installed from AI SDK Elements were copied into your project, so they keep working.
When you are ready, each pattern page has a migration prompt. Paste it into your coding agent, and it rebuilds the wrapper in components/ai-elements on Trace, Code Block and the other shadcn/ui components. Every export keeps its name and props, so the code that uses it does not change.
See Migrating from AI SDK Elements for the element that replaces each file, and for the elements we did not rebuild. If you still need one of those, open an issue and we will help you build it.