AI Elements

Overview

Copy-paste patterns for agentic and chat interfaces, built from UI Thing components.

Credits

Shout out to Shadcn Vue for the original AI Elements. Every pattern here was ported to UI Thing components, and several were extended with more states and options. A few patterns are new.

About

AI Elements are patterns for building agentic interfaces. Each one is a composition of UI Thing components that you copy into your project. There is no package to install. The code is yours.

A Chat is a list of Message turns inside a Message Scroller. The steps an agent takes inside a turn, like Reasoning, Tool and Plan, are built on Trace, so every step has the same shape. Code, terminal output and diffs are shown with Code Block.

Patterns, not packages
Patterns are not installed with the CLI. Open a pattern, run the command on its page to add the components it uses (for example ui-thing@latest add trace code-block), and copy the example into your project.

Patterns

PatternShowsBuilt with
Chain of ThoughtA summary that expands into the steps an agent took.Trace, Badge
ChatThe thread. Message Scroller keeps your place while the reply streams.Message Scroller, Message, Prompt Input
CheckpointA point in the conversation you can return to.Marker, Button
ConfirmationA prompt to approve or deny a tool before it runs.Item, Button, Trace
ContextHow much of the context window the conversation has used.Hover Card, Progress
File TreeThe files the agent changed, as a folder tree.Collapsible
Inline CitationA source in the sentence that opens on hover.Hover Card
MessageOne turn. The person's message, and the agent's reply with its actions.Message, Bubble, Tooltip
Model SelectorTwo menus. One picks the model the agent runs, the other how hard it thinks.Dropdown Menu, Input Group
PlanThe steps the agent plans to take, and how far it has got.Trace
Prompt InputA message field with attachments and a send button.Input Group, Attachment, Dropdown Menu
QueueThe agent's todo list, split into what is left and what is done.Trace
ReasoningThe agent's thinking as it streams.Trace
SourcesThe links the agent used for a reply.Trace
Stack TraceA failed tool call and its stack frames.Trace, Code Block
SubagentA subagent run, with its tool calls and result.Trace, Code Block, Badge
SuggestionA short prompt you can send to the agent in one click.Button, Input Group
TaskThe steps the agent takes, as it takes them.Trace
TerminalA command the agent runs, with its output as it streams.Trace, Code Block
Test ResultsA test run by the agent, with its suites and failures.Trace, Code Block
ToolA tool call the agent makes, from input to output.Trace, Code Block, Sheet

More patterns

These are not part of Shadcn Vue's AI Elements. They were added for UI Thing.

PatternShowsBuilt with
ArtifactA file the agent made, with actions to copy, download or close it.Card, Code Block
BranchStep between the versions of a regenerated reply.Message, Button
FeedbackThumbs up and down, with a follow-up when something went wrong.Message, Button, Textarea
SnippetA command to copy in one click, with a package manager switch.Input Group, Tabs
Voice InputDictate into the prompt with speech recognition.Input Group, Tooltip

Using them

  1. Add the components the pattern uses:
    npx ui-thing@latest add trace code-block
    
  2. Open a pattern above and copy its code into your project. Each page lists any other components it needs.
  3. Wire it to your data. The examples simulate streaming with VueUse so they run on their own. Swap the simulation for new Chat() from @ai-sdk/vue, or whatever your backend gives you. The AI SDK sections of each page show how the parts map.

The demos share a tiny Markdown renderer so you can see fenced code render as a Code Block. In your app, use the Markdown library you already have and map fenced code to UiCodeBlock.

Utilities
Trace and Code Block use the shimmer and scroll fade utilities. Add them to your CSS if you have not yet.