ai-elements

Build AI chat interfaces with ai-elements React components for conversations, messages, and tool displays.

Updated Dec 17, 2022
One-click install
npx skills add https://github.com/Foodshareclub/foodshare-web --skill ai-elements-foodshareclub
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-elements
Source: https://github.com/Foodshareclub/foodshare-web/tree/main/.agents/skills/ai-elements
Command: npx skills add https://github.com/Foodshareclub/foodshare-web --skill ai-elements-foodshareclub

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ai-elements, ai, @ai-sdk/react, zod, lucide-react, nanoid, media-chrome, and includes scripts (resource) and references (resource) components.

What problem does it solve? Building AI chat interfaces from scratch requires assembling conversations, message rendering, tool call displays, prompt inputs, and reasoning visualizations, which is repetitive and error-prone. This Skill provides pre-built, composable React components from the ai-elements library so you can assemble AI-native UIs quickly on top of shadcn/ui and the Vercel AI SDK. ## Core Features & Use Cases - Chat Building Blocks: Conversations, messages, prompt inputs, attachments, and suggestions for complete chatbot interfaces. - AI-Specific Displays: Chain-of-thought reasoning steps, tool call accordions, agent configuration panels, artifacts, code blocks, and audio players. - Use Case: You are adding an AI assistant to a Next.js app. Install the message and conversation components, wire them to the AI SDK's useChat hook, and render streaming responses with markdown support in minutes. ## Quick Start Install the ai-elements components into my Next.js project and build a chat interface using the conversation and message components with the AI SDK useChat hook.

Frequently Asked Questions about ai-elements

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I install ai-elements components in a Next.js project?

Run the ai-elements CLI with your package runner, such as npx ai-elements@latest add message, from your project root. The CLI copies the component code into your components/ai-elements directory and installs any needed dependencies, including shadcn/ui if missing.

How to render AI SDK chat messages with React components?

Use the useChat hook from @ai-sdk/react and map over messages with the Message, MessageContent, and MessageResponse components. MessageResponse renders markdown text, and you can switch on part types to handle text, tool calls, and other content.

Does ai-elements work with shadcn/ui and Tailwind CSS 4?

Yes, ai-elements is built on shadcn/ui and requires a Tailwind 4 setup with a globals.css that imports Tailwind and includes the shadcn/ui base styles. If components appear unstyled, verify your globals.css configuration first.

Why do ai-elements component imports fail with module not found?

Import failures usually mean the @/ path alias is missing from tsconfig.json. Add a paths entry mapping @/* to ./* under compilerOptions, and confirm the component files exist in your components/ai-elements directory.

Can I customize ai-elements components after installation?

Yes, components are copied into your codebase rather than installed as a hidden library, so you can edit them directly. For example, open components/ai-elements/message.tsx and change Tailwind classes like rounded-lg to adjust styling.