October 2026 - Trace, Code Block and AI Elements
Today, we are releasing two new components, Trace and Code Block, and AI Elements, a set of patterns for agentic interfaces built from shadcn-svelte components.
Trace and Code Block are available for Svelte across all eight styles.
Trace
Trace is a list of lines for the steps an agent takes. Each line has 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.
Reasoning, tool calls, sources, plans and subagent runs all have the same shape: something the agent did, and what happened. Trace gives those steps a shared composition:
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.
- Examples for reasoning, tool and source parts from the AI SDK using
@ai-sdk/svelte. - Keyboard and screen reader support from the link or trigger that wraps each line.
npx shadcn-svelte@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 { convertToModelMessages, streamText } from "ai"import type { RequestHandler } from "./$types"
export const POST: RequestHandler = async ({ 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: await convertToModelMessages(messages), })
return result.toUIMessageStreamResponse()}npx shadcn-svelte@latest add code-block Syntax highlighting uses the separate useHighlightedCode hook, which is installed with code-block. Blocks that only show plain output can render it without highlighting.
Building agentic interfaces
Trace and Code Block join the components for chat interfaces announced earlier this month. Together, they cover the pieces 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 Svelte composition you copy into your project, and the code is yours.
There are 21 patterns, from Chat and Prompt Input to Reasoning, Tool, Plan and Subagent. The AI SDK examples use @ai-sdk/svelte. The patterns read message parts, so you can also use them with another source of messages.
Every page is also available as Markdown, so you can point your coding agent at it:
Add the Reasoning pattern from https://shadcn-svelte.com/docs/ai-elements/reasoning.md to my Svelte chat. Using existing AI Elements components
If you already use Svelte AI Elements, you can keep the components in your project and adopt these patterns one at a time.
Each pattern page lists the shadcn-svelte components it uses and includes Svelte code and AI SDK message-part examples. Copy the pattern you need, then adapt your existing wrappers and message handling to its composition.
Read the Docs