Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.
Coding
Ai Elements
Try itVercel AI Elements for workflow UI components. Use when building chat interfaces, displaying tool execution, showing reasoning/thinking, or creating job queu...
What it does
AI Elements is a comprehensive React component library for building AI-powered user interfaces. The library provides 30+ components specifically designed for chat interfaces, tool execution visualization, reasoning displays, and workflow management.
The skill document
AI Elements
AI Elements is a comprehensive React component library for building AI-powered user interfaces. The library provides 30+ components specifically designed for chat interfaces, tool execution visualization, reasoning displays, and workflow management.
Installation
Install via shadcn registry:
npx shadcn@latest add https://ai-elements.vercel.app/r/[component-name]
Import Pattern: Components are imported from individual files, not a barrel export:
// Correct - import from specific files
import { Conversation } from "@/components/ai-elements/conversation";
import { Message } from "@/components/ai-elements/message";
import { PromptInput } from "@/components/ai-elements/prompt-input";
// Incorrect - no barrel export
import { Conversation, Message } from "@/components/ai-elements";
Gates (before relying on examples)
Use this sequence when adding or wiring AI Elements so setup is checkable, not assumed.
-
Install each component — Run
npx shadcn@latest add https://ai-elements.vercel.app/r/[component-name]for every component you need.- Pass: The command completes successfully and a file for that component exists under your project’s
components/ai-elements/(or the directorycomponents.jsonuses for those additions).
- Pass: The command completes successfully and a file for that component exists under your project’s
-
Align import paths — Every
import … from "@/components/ai-elements/..."must match your repo’s actual alias and folder layout.- Pass: Each import resolves to a file on disk (IDE navigation or build/
tscshows no “cannot find module” for those paths).
- Pass: Each import resolves to a file on disk (IDE navigation or build/
-
Match
Tool/Confirmationstates to your AI SDK — State strings (including approval-related states) depend on the installedaipackage major/version.- Pass: The states you pass to
ToolHeader,Tool, orConfirmationare listed in the AI SDK version you have installed (docs or exported types), not copied from memory alone.
- Pass: The states you pass to
Component Categories
Conversation Components
Components for displaying chat-style interfaces with messages, attachments, and auto-scrolling behavior.
- Conversation: Container with auto-scroll capabilities
- Message: Individual message display with role-based styling
- MessageAttachment: File and image attachments
- MessageBranch: Alternative response navigation
See references/conversation.md for details.
Prompt Input Components
Advanced text input with file attachments, drag-and-drop, speech input, and state management.
- PromptInput: Form container with file handling
- PromptInputTextarea: Auto-expanding textarea
- PromptInputSubmit: Status-aware submit button
- PromptInputAttachments: File attachment display
- PromptInputProvider: Global state management
See references/prompt-input.md for details.
Workflow Components
Components for displaying job queues, tool execution, and approval workflows.
- Queue: Job queue container
- QueueItem: Individual queue items with status
- Tool: Tool execution display with collapsible states
- Confirmation: Approval workflow component
- Reasoning: Collapsible thinking/reasoning display
See references/workflow.md for details.
Visualization Components
ReactFlow-based components for workflow visualization and custom node types.
- Canvas: ReactFlow wrapper with aviation-specific defaults
- Node: Custom node component with handles
- Edge: Temporary and Animated edge types
- Controls, Panel, Toolbar: Navigation and control elements
See references/visualization.md for details.
Integration with shadcn/ui
AI Elements is built on top of shadcn/ui and integrates seamlessly with its theming system:
- Uses shadcn/ui's design tokens (colors, spacing, typography)
- Respects light/dark mode via CSS variables
- Compatible with shadcn/ui components (Button, Card, Collapsible, etc.)
- Follows shadcn/ui's component composition patterns
Key Design Patterns
Component Composition
AI Elements follows a composition-first approach where larger components are built from smaller primitives:
Context-Based State
Many components use React Context for state management:
PromptInputProviderfor global input stateMessageBranchfor alternative response navigationConfirmationfor approval workflow stateReasoningfor collapsible thinking state
Controlled vs Uncontrolled
Components support both controlled and uncontrolled patterns:
// Uncontrolled (self-managed state)
// Controlled (external state)
Tool State Machine
The Tool component follows the Vercel AI SDK's state machine:
input-streaming: Parameters being receivedinput-available: Ready to executeapproval-requested: Awaiting user approval (SDK v6)approval-responded: User responded (SDK v6)output-available: Execution completedoutput-error: Execution failedoutput-denied: Approval denied
Queue Patterns
Queue components support hierarchical organization:
} />
Task description
Auto-Scroll Behavior
The Conversation component uses the use-stick-to-bottom hook for intelligent auto-scrolling:
- Automatically scrolls to bottom when new messages arrive
- Pauses auto-scroll when user scrolls up
- Provides scroll-to-bottom button when not at bottom
- Supports smooth and instant scroll modes
File Attachment Handling
PromptInput provides comprehensive file handling:
- Drag-and-drop support (local or global)
- Paste image/file support
- File type validation (accept prop)
- File size limits (maxFileSize prop)
- Maximum file count (maxFiles prop)
- Preview for images, icons for files
- Automatic blob URL to data URL conversion on submit
Speech Input
The PromptInputSpeechButton uses the Web Speech API for voice input:
- Browser-based speech recognition
- Continuous recognition mode
- Interim results support
- Automatic text insertion into textarea
- Visual feedback during recording
Reasoning Auto-Collapse
The Reasoning component provides auto-collapse behavior:
- Opens automatically when streaming starts
- Closes 1 second after streaming ends
- Tracks thinking duration in seconds
- Displays "Thinking..." with shimmer effect during streaming
- Shows "Thought for N seconds" when complete
TypeScript Types
All components are fully typed with TypeScript:
import type { ToolUIPart, FileUIPart, UIMessage } from "ai";
type ToolProps = ComponentProps;
type QueueItemProps = ComponentProps<"li">;
type MessageAttachmentProps = HTMLAttributes & {
data: FileUIPart;
onRemove?: () => void;
};
Common Use Cases
Chat Interface
Combine Conversation, Message, and PromptInput for a complete chat UI:
import { Conversation, ConversationContent, ConversationScrollButton } from "@/components/ai-elements/conversation";
import { Message, MessageContent, MessageResponse } from "@/components/ai-elements/message";
import {
PromptInput,
PromptInputTextarea,
PromptInputFooter,
PromptInputTools,
PromptInputButton,
PromptInputSubmit
} from "@/components/ai-elements/prompt-input";
{messages.map(msg => (
{msg.content}
))}
attachments.openFileDialog()}>
Tool Execution Display
Show tool execution with expandable details:
import { Tool, ToolHeader, ToolContent, ToolInput, ToolOutput } from "@/components/ai-elements/tool";
{toolInvocations.map(tool => (
{tool.result && (
)}
))}
Approval Workflow
Request user confirmation before executing actions:
import {
Confirmation,
ConfirmationTitle,
ConfirmationRequest,
ConfirmationActions,
ConfirmationAction,
ConfirmationAccepted,
ConfirmationRejected
} from "@/components/ai-elements/confirmation";
Approve deletion of {resource}?
Approve
Reject
Action approved and executed.
Action rejected.
Job Queue Management
Display task lists with completion status:
import {
Queue,
QueueSection,
QueueSectionTrigger,
QueueSectionLabel,
QueueSectionContent,
QueueList,
QueueItem,
QueueItemIndicator,
QueueItemContent,
QueueItemDescription
} from "@/components/ai-elements/queue";
{todos.map(todo => (
{todo.title}
{todo.description && (
{todo.description}
)}
))}
Accessibility
Components include accessibility features:
- ARIA labels and roles
- Keyboard navigation support
- Screen reader announcements
- Focus management
- Semantic HTML elements
Animation
Many components use Framer Motion for smooth animations:
- Shimmer effect for loading states
- Collapsible content transitions
- Edge animations in Canvas
- Loader spinner rotation
References
- Conversation Components
- Prompt Input Components
- Workflow Components
- Visualization Components
Related skills
Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.
Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.
Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.
Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.
Write, debug, and tune Playwright specs with locator strategy, trace diagnosis, and CI-aware timeouts.
More from anderskev
Browse all skillsGet a structured template and writing principles for explanation docs that build reader understanding of why systems work the way they do.
Step-by-step tutorial patterns for learning-by-doing docs that get beginners to a visible result.
Turn a brainstorm spec with open questions into an implementation-ready spec with no gaps.
Turn a fuzzy idea into a structured, implementation-free project spec through collaborative dialogue.
Configure Tailwind CSS v4 with CSS-first theme variables and OKLCH design tokens.
Generate Architecture Decision Records from decisions made in the current session.