126k

AI Elements

Patterns for agentic interfaces, built from shadcn/ui components.

AI Elements are patterns for building agentic interfaces. Each one is a composition of shadcn/ui 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.

Coming from elements.ai-sdk.dev? See Migrating from AI SDK Elements.

Patterns

Migrating from AI SDK Elements

If you used AI SDK Elements from elements.ai-sdk.dev, here is what changes.

Existing projects

You do not need to migrate. When you installed components from elements.ai-sdk.dev, the code was copied into your project. It is yours, and it keeps working as is.

To move a wrapper onto shadcn/ui components, use the prompt in the Migrating from AI SDK Elements section of its pattern page. Paste it into your coding agent. It rebuilds the file in components/ai-elements on Trace, Code Block and the other shadcn/ui components, and keeps every export and its props, so the code that uses it does not change.

For example, the Queue prompt rebuilds queue.tsx on Trace, and the Inline Citation prompt rebuilds inline-citation.tsx on Hover Card.

What replaces each element

Each file from AI SDK Elements, and the shadcn/ui pattern or component that replaces it.

AI SDK Elementsshadcn/ui
agent.tsxSubagent
attachments.tsxAttachment
chain-of-thought.tsxChain of Thought
checkpoint.tsxCheckpoint
code-block.tsxCode Block
commit.tsxTrace
confirmation.tsxConfirmation
context.tsxContext
conversation.tsxChat
file-tree.tsxFile Tree
inline-citation.tsxInline Citation
message.tsxMessage
model-selector.tsxModel Selector
plan.tsxPlan
prompt-input.tsxPrompt Input
question.tsxQuestionnaire
queue.tsxQueue
reasoning.tsxReasoning
shimmer.tsxshimmer
sources.tsxSources
stack-trace.tsxStack Trace
suggestion.tsxSuggestion
task.tsxTask
terminal.tsxTerminal
test-results.tsxTest Results
tool.tsxTool

Elements without a replacement

We did not rebuild these elements. We looked at how often each one is used, and the numbers are low. Each one is also a small composition you can build from components shadcn/ui already has, listed below.

Your copy keeps working. If you still need one of these, open an issue and we will help you build it.

AI SDK ElementsBuild it with
artifact.tsxCard, Button and Tooltip
audio-player.tsxAn audio element, with Button Group and Slider
canvas.tsx, connection.tsx, controls.tsx, edge.tsx, node.tsx, panel.tsx and toolbar.tsxReact Flow, with Card and Button Group
environment-variables.tsxItem, Badge and Switch
image.tsxAn img element
jsx-preview.tsxA JSX parser, like react-jsx-parser
mic-selector.tsx and voice-selector.tsxCombobox
open-in-chat.tsxDropdown Menu
package-info.tsxItem and Badge
persona.tsxA Rive animation
sandbox.tsxTrace, Tabs and Code Block
schema-display.tsxCollapsible, Badge and Code Block
snippet.tsxInput Group
speech-input.tsxButton and Spinner, with the Web Speech API
transcription.tsxA Button for each segment, to seek to it
web-preview.tsxAn iframe, with Input Group for the address bar

New projects

Build from shadcn/ui components instead.

Add the components

pnpm dlx shadcn@latest add trace code-block

Copy a pattern

Open a pattern above and copy its code into your project. Each page lists any other components it needs.

Or ask your coding agent to do it:

Prompt
Add the Reasoning pattern from https://ui.shadcn.com/docs/ai-elements/base/reasoning.md to my chat.