NEW Browse AI tools across categories — updated daily. See what's new →

Ai Elements

Pre-built React components for AI chat interfaces built on shadcn/ui and the AI SDK. Includes conversation, message, tool display, and prompt input components designed for AI-native applications In...

Authorvercel
Version1.0.0
LicenseMIT
Token count~2,188
UpdatedJun 5, 2026

Pre-built React components for AI chat interfaces built on shadcn/ui and the AI SDK. Includes conversation, message, tool display, and prompt input components designed for AI-native applications Installs directly into your project codebase via CLI, making components fully customizable and extensible with standard React patterns Requires Next.js, AI SDK, shadcn/ui, and Node.js 18+; integrates seamlessly with Vercel's AI Gateway for model access All components support standard HTML attributes...

Install

Quick install

via npx skills · works with 57+ agents
npx skills add https://github.com/vercel/ai-elements/tree/HEAD/skills/ai-elements
Or pick agent:
npx skills add vercel/ai-elements --skill ai-elements --agent claude-code
npx skills add vercel/ai-elements --skill ai-elements --agent cursor
npx skills add vercel/ai-elements --skill ai-elements --agent codex
npx skills add vercel/ai-elements --skill ai-elements --agent opencode
npx skills add vercel/ai-elements --skill ai-elements --agent github-copilot
npx skills add vercel/ai-elements --skill ai-elements --agent windsurf
More install options

Shorthand — useful for multi-skill repos:

npx skills add vercel/ai-elements --skill ai-elements

Manual — clone the repo and drop the folder into your agent's skills directory:

git clone https://github.com/vercel/ai-elements.git
cp -r ai-elements/skills/ai-elements ~/.claude/skills/
How to use: Once installed, ask your agent to "use the ai-elements skill" or describe what you want (e.g. "Pre-built React components for AI chat interfaces built on shadcn/ui and the AI"). Requires Node.js 18+.

ai-elements

Pre-built React components for AI chat interfaces built on shadcn/ui and the AI SDK. Includes conversation, message, tool display, and prompt input components designed for AI-native applications Installs directly into your project codebase via CLI, making components fully customizable and extensible with standard React patterns Requires Next.js, AI SDK, shadcn/ui, and Node.js 18+; integrates seamlessly with Vercel's AI Gateway for model access All components support standard HTML attributes...

ai-elementsby vercel

Pre-built React components for AI chat interfaces built on shadcn/ui and the AI SDK. Includes conversation, message, tool display, and prompt input components designed for AI-native applications Installs directly into your project codebase via CLI, making components fully customizable and extensible with standard React patterns Requires Next.js, AI SDK, shadcn/ui, and Node.js 18+; integrates seamlessly with Vercel's AI Gateway for model access All components support standard HTML attributes...

npx skills add https://github.com/vercel/ai-elements --skill ai-elementsDownload ZIPGitHub

AI Elements

AI Elements is a component library and custom registry built on top of shadcn/ui 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, version 18 or later
  • A Next.js project with the AI SDK installed.
  • shadcn/ui 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 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.

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:

`"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. You can style or configure the component just as you would if you wrote it yourself – since the code lives in your project, you can even open the component file to see how it works or make custom modifications.

Extensibility

All AI Elements components take as many primitive attributes as possible. For example, the Message component extends HTMLAttributes<HTMLDivElement>, so you can pass any props that a div supports. This makes it easy to extend the component with your own styles or functionality.

Customization

After installation, no additional setup is needed. The component’s styles (Tailwind CSS classes) and scripts are already integrated. You can start interacting with the component in your app immediately.

For example, if you'd like to remove the rounding on Message, you can go to components/ai-elements/message.tsx and remove rounded-lg as follows:

`export const MessageContent = ({
children,
className,
...props
}: MessageContentProps) => (
<div
className={cn(
"flex flex-col gap-2 text-sm text-foreground",
"group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground group-[.is-user]:px-4 group-[.is-user]:py-3",
className
)}
{...props}
>
<div className="is-user:dark">{children}</div>
</div>
);
`

Troubleshooting

Why are my components not styled?

Make sure your project is configured correctly for shadcn/ui in Tailwind 4 - this means having a globals.css file that imports Tailwind and includes the shadcn/ui base styles.

I ran the AI Elements CLI but nothing was added to my project

Double-check that:

  • Your current working directory is the root of your project (where package.json lives).
  • Your components.json file (if using shadcn-style config) is set up correctly.
  • You’re using the latest version of the AI Elements CLI:
`npx ai-elements@latest
`

If all else fails, feel free to open an issue on GitHub.

Theme switching doesn’t work — my app stays in light mode

Ensure your app is using the same data-theme system that shadcn/ui and AI Elements expect. The default implementation toggles a data-theme attribute on the <html> element. Make sure your tailwind.config.js is using class or data- selectors accordingly.

The component imports fail with “module not found”

Check the file exists. If it does, make sure your tsconfig.json has a proper paths alias for @/ i.e.

`{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}
`

My AI coding assistant can't access AI Elements components

  • Verify your config file syntax is valid JSON.
  • Check that the file path is correct for your AI tool.
  • Restart your coding assistant after making changes.
  • Ensure you have a stable internet connection.

Still stuck?

If none of these answers help, open an issue on GitHub and someone will be happy to assist.

Available Components

See the references/ folder for detailed documentation on each component.

More skills from vercel

agent-friendly-apisby vercelCompanion skill for the Agent-Friendly APIs course on Vercel Academy. Build a feedback API, make it agent-friendly with structured documentation, then create a Claude Code skill that generates the docs automatically.filesystem-agentsby vercelYou are a knowledgeable teaching assistant for the Building Filesystem Agents course on Vercel Academy. You help students build agents that navigate filesystems with bash to answer questions about structured data.add-provider-packageby vercelGuide for adding new AI provider packages to the AI SDK. Use when creating a new @ai-sdk/<provider> package to integrate an AI service into the SDK.csvby vercelAnalyze and transform CSV data using bash toolsaiby vercelPython ai module — models, agents, hooks, middleware, MCP, structured outputcron-jobsby vercelVercel Cron Jobs configuration and best practices. Use when adding, editing, or debugging scheduled tasks in vercel.json.frontend-designby vercelCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts,…vercel-react-best-practicesby vercelReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js…

---

Source: https://github.com/vercel/ai-elements/tree/HEAD/skills/ai-elements
Author: vercel
Discovered via: mcpservers.org

SKILL.md source

---
name: ai-elements
description: Pre-built React components for AI chat interfaces built on shadcn/ui and the AI SDK. Includes conversation, message, tool display, and prompt input components designed for AI-native applications In...
---

# ai-elements

Pre-built React components for AI chat interfaces built on shadcn/ui and the AI SDK. Includes conversation, message, tool display, and prompt input components designed for AI-native applications Installs directly into your project codebase via CLI, making components fully customizable and extensible with standard React patterns Requires Next.js, AI SDK, shadcn/ui, and Node.js 18+; integrates seamlessly with Vercel's AI Gateway for model access All components support standard HTML attributes...

# ai-elementsby vercel
Pre-built React components for AI chat interfaces built on shadcn/ui and the AI SDK. Includes conversation, message, tool display, and prompt input components designed for AI-native applications Installs directly into your project codebase via CLI, making components fully customizable and extensible with standard React patterns Requires Next.js, AI SDK, shadcn/ui, and Node.js 18+; integrates seamlessly with Vercel's AI Gateway for model access All components support standard HTML attributes...

`npx skills add https://github.com/vercel/ai-elements --skill ai-elements`Download ZIPGitHub

## AI Elements

AI Elements is a component library and custom registry built on top of shadcn/ui 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, version 18 or later

* A Next.js project with the AI SDK installed.

* shadcn/ui 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 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.

## 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:

```
`"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. You can style or configure the component just as you would if you wrote it yourself – since the code lives in your project, you can even open the component file to see how it works or make custom modifications.

## Extensibility

All AI Elements components take as many primitive attributes as possible. For example, the `Message` component extends `HTMLAttributes<HTMLDivElement>`, so you can pass any props that a `div` supports. This makes it easy to extend the component with your own styles or functionality.

## Customization

After installation, no additional setup is needed. The component’s styles (Tailwind CSS classes) and scripts are already integrated. You can start interacting with the component in your app immediately.

For example, if you'd like to remove the rounding on `Message`, you can go to `components/ai-elements/message.tsx` and remove `rounded-lg` as follows:

```
`export const MessageContent = ({
children,
className,
...props
}: MessageContentProps) => (
<div
className={cn(
"flex flex-col gap-2 text-sm text-foreground",
"group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground group-[.is-user]:px-4 group-[.is-user]:py-3",
className
)}
{...props}
>
<div className="is-user:dark">{children}</div>
</div>
);
`
```

## Troubleshooting

### Why are my components not styled?

Make sure your project is configured correctly for shadcn/ui in Tailwind 4 - this means having a `globals.css` file that imports Tailwind and includes the shadcn/ui base styles.

### I ran the AI Elements CLI but nothing was added to my project

Double-check that:

* Your current working directory is the root of your project (where `package.json` lives).

* Your components.json file (if using shadcn-style config) is set up correctly.

* You’re using the latest version of the AI Elements CLI:

```
`npx ai-elements@latest
`
```

If all else fails, feel free to open an issue on GitHub.

### Theme switching doesn’t work — my app stays in light mode

Ensure your app is using the same data-theme system that shadcn/ui and AI Elements expect. The default implementation toggles a data-theme attribute on the `<html>` element. Make sure your tailwind.config.js is using class or data- selectors accordingly.

### The component imports fail with “module not found”

Check the file exists. If it does, make sure your `tsconfig.json` has a proper paths alias for `@/` i.e.

```
`{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}
`
```

### My AI coding assistant can't access AI Elements components

* Verify your config file syntax is valid JSON.

* Check that the file path is correct for your AI tool.

* Restart your coding assistant after making changes.

* Ensure you have a stable internet connection.

### Still stuck?

If none of these answers help, open an issue on GitHub and someone will be happy to assist.

## Available Components

See the `references/` folder for detailed documentation on each component.

## More skills from vercel
agent-friendly-apisby vercelCompanion skill for the Agent-Friendly APIs course on Vercel Academy. Build a feedback API, make it agent-friendly with structured documentation, then create a Claude Code skill that generates the docs automatically.filesystem-agentsby vercelYou are a knowledgeable teaching assistant for the Building Filesystem Agents course on Vercel Academy. You help students build agents that navigate filesystems with bash to answer questions about structured data.add-provider-packageby vercelGuide for adding new AI provider packages to the AI SDK. Use when creating a new @ai-sdk/<provider> package to integrate an AI service into the SDK.csvby vercelAnalyze and transform CSV data using bash toolsaiby vercelPython `ai` module — models, agents, hooks, middleware, MCP, structured outputcron-jobsby vercelVercel Cron Jobs configuration and best practices. Use when adding, editing, or debugging scheduled tasks in vercel.json.frontend-designby vercelCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts,…vercel-react-best-practicesby vercelReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js…

---

**Source**: https://github.com/vercel/ai-elements/tree/HEAD/skills/ai-elements
**Author**: vercel
**Discovered via**: mcpservers.org

Related skills 6

caveman

★ Featured

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

juliusbrussee 167k
Development

secure-linux-web-hosting

★ Featured

Use when setting up, hardening, or reviewing a cloud server for self-hosting, including DNS, SSH, firewalls, Nginx, static-site hosting, reverse-proxying an app, HTTPS with Let's Encrypt or ACME clients, safe HTTP-to-HTTPS redirects, or optional post-launch network tuning such as BBR.

xixu-me 155k
Development

readme-i18n

★ Featured

Use when the user wants to translate a repository README, make a repo multilingual, localize docs, add a language switcher, internationalize the README, or update localized README variants in a GitHub-style repository.

xixu-me 155k
Development

lark-shared

★ Featured

Use when first setting up lark-cli, running auth login, switching user/bot identity (--as), handling permission denied or scope errors, needing to update lark-cli, or seeing _notice in JSON output.

larksuite 155k
Development

improve-codebase-architecture

★ Featured

Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.

mattpocock 151k
Development

paper-context-resolver

★ Featured

Optional RigorPilot helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacin...

lllllllama 127k
Development