
Ai Elements
Install and compose Vercel AI Elements on shadcn/ui to ship conversation, message, tool, and prompt-input UIs for Next.js chat products.
Overview
AI Elements is an agent skill for the Build phase that guides installing and composing Vercel ai-elements chat UI components on Next.js, shadcn/ui, and the AI SDK.
Install
npx skills add https://github.com/vercel/ai-elements --skill ai-elementsWhat is this skill?
- Component library on shadcn/ui for AI-native chat: conversations, messages, tool displays, prompt inputs
- Install via ai-elements CLI (npx / pnpm dlx / bunx) matched to project packageManager
- Requires Node 18+, Next.js, AI SDK, and existing or auto-installed shadcn/ui
- Custom registry workflow compatible with standard shadcn/ui CLI adoption
- Explicit trigger: build chatbots, AI assistant UI, or any AI-powered chat interface
- Node.js version 18 or later required per prerequisites
Adoption & trust: 10.8k installs on skills.sh; 2.1k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have model streaming working but lack polished chat, tool, and prompt components and do not want to rebuild shadcn patterns from scratch.
Who is it for?
Solo builders on Next.js with shadcn/ui who are shipping a chatbot or in-app AI assistant this sprint.
Skip if: Non-React stacks, mobile-native-only UIs, or projects without the Vercel AI SDK and Next.js baseline.
When should I use this skill?
Use when the user wants to build a chatbot, AI assistant UI, or any AI-powered chat interface.
What do I get? / Deliverables
You install ai-elements via the CLI and assemble conversation, message, and prompt-input surfaces that match AI SDK conventions in your Next.js app.
- Installed ai-elements components in the Next.js app
- Composed chat UI (conversation, messages, tools, prompt input)
Recommended Skills
Journey fit
AI Elements targets the frontend build phase where solo builders assemble chat and assistant interfaces on Next.js. Frontend subphase covers registry components for conversations, messages, tool displays, and prompt inputs atop shadcn/ui.
How it compares
UI component registry skill for Next.js chat—not an MCP server or generic CSS kit unrelated to the AI SDK.
Common Questions / FAQ
Who is ai-elements for?
Indie developers building Next.js AI chat or assistant products who want shadcn-compatible, AI SDK-aligned components instead of custom UI from zero.
When should I use ai-elements?
During build/frontend when the user asks for a chatbot, AI assistant UI, or AI-powered chat interface and your stack is Next.js plus shadcn/ui.
Is ai-elements safe to install?
Installation pulls npm packages and may modify your frontend tree; review the Security Audits panel on this Prism page and lock versions in package.json.
SKILL.md
READMESKILL.md - Ai Elements
# AI Elements [AI Elements](https://www.npmjs.com/package/ai-elements) is a component library and custom registry built on top of [shadcn/ui](https://ui.shadcn.com/) to help you build AI-native applications faster. It provides pre-built components like conversations, messages and more. Installing AI Elements is straightforward and can be done in a couple of ways. You can use the dedicated CLI command for the fastest setup, or integrate via the standard shadcn/ui CLI if you've already adopted shadcn's workflow. > **IMPORTANT:** Run all CLI commands using the project's package runner: `npx ai-elements@latest`, `pnpm dlx ai-elements@latest`, or `bunx --bun ai-elements@latest` — based on the project's `packageManager`. Examples below use `npx ai-elements@latest` but substitute the correct runner for the project. ## Prerequisites Before installing AI Elements, make sure your environment meets the following requirements: - [Node.js](https://nodejs.org/en/download/), version 18 or later - A [Next.js](https://nextjs.org/) project with the [AI SDK](https://ai-sdk.dev/) installed. - [shadcn/ui](https://ui.shadcn.com/) installed in your project. If you don't have it installed, running any install command will automatically install it for you. - We also highly recommend using the [AI Gateway](https://vercel.com/docs/ai-gateway) and adding `AI_GATEWAY_API_KEY` to your `env.local` so you don't have to use an API key from every provider. AI Gateway also gives $5 in usage per month so you can experiment with models. You can obtain an API key [here](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys&title=Get%20your%20AI%20Gateway%20key). ## Installing Components You can install AI Elements components using either the AI Elements CLI or the shadcn/ui CLI. Both achieve the same result: adding the selected component’s code and any needed dependencies to your project. The CLI will download the component’s code and integrate it into your project’s directory (usually under your components folder). By default, AI Elements components are added to the `@/components/ai-elements/` directory (or whatever folder you’ve configured in your shadcn components settings). After running the command, you should see a confirmation in your terminal that the files were added. You can then proceed to use the component in your code. ## Usage Once an AI Elements component is installed, you can import it and use it in your application like any other React component. The components are added as part of your codebase (not hidden in a library), so the usage feels very natural. ## Example After installing AI Elements components, you can use them in your application like any other React component. For example: ```tsx title="conversation.tsx" "use client"; import { Message, MessageContent, MessageResponse, } from "@/components/ai-elements/message"; import { useChat } from "@ai-sdk/react"; const Example = () => { const { messages } = useChat(); return ( <> {messages.map(({ role, parts }, index) => ( <Message from={role} key={index}> <MessageContent> {parts.map((part, i) => { switch (part.type) { case "text": return ( <MessageResponse key={`${role}-${i}`}> {part.text} </MessageResponse> ); } })} </MessageContent> </Message> ))} </> ); }; export default Example; ``` In the example above, we import the `Message` component from our AI Elements directory and include it in our JSX. Then, we compose the component with the `MessageContent` and `MessageResponse` subcomponents.