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.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/vercel--ai-elements)HTML
<a href="/listings/vercel--ai-elements"><img src="/api/listings/vercel--ai-elements/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
You can use the AI Elements CLI directly with npx, or install it globally:
# Use directly (recommended) npx ai-elements@latest # Or using shadcn cli npx shadcn@latest add https://elements.ai-sdk.dev/api/registry/all.json
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
README.md · README · 153 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- # ▲ AI Elements
- > [!WARNING]
- > **AI Elements is moving to shadcn/ui.** This project will be deprecated at the end of November 2026 and replaced by [AI Elements from shadcn/ui](https://ui.shadcn.com/docs/ai-elements). New projects should use the shadcn/ui version once it's available.
- [AI Elements](https://elements.ai-sdk.dev) is a component library built on top of [shadcn/ui](https://ui.shadcn.com/) to help you build AI-native applications faster.
- ## Overview
- AI Elements provides pre-built, customizable React components specifically designed for AI applications, including conversations, messages, code blocks, reasoning displays, and more. The CLI makes it easy to add these components to your Next.js project.
- ## Installation
- You can use the AI Elements CLI directly with npx, or install it globally:
- ```bash
- # Use directly (recommended)
- npx ai-elements@latest
- # Or using shadcn cli
- npx shadcn@latest add https://elements.ai-sdk.dev/api/registry/all.json
- ```
- ## Prerequisites
- Before using AI Elements, ensure your project meets these requirements:
- - **Node.js** 18 or later
- - **Next.js** project with [AI SDK](https://ai-sdk.dev/) installed
- - **shadcn/ui** initialized in your project (`npx shadcn@latest init`)
- - **Tailwind CSS** configured (AI Elements supports CSS Variables mode only)
- ## Usage
- ### Install All Components
- Install all available AI Elements components at once:
- ```bash
- npx ai-elements@latest
- ```
- This command will:
- - Set up shadcn/ui if not already configured
- - Install all AI Elements components to your configured components directory
- - Add necessary dependencies to your project
- ### Install Specific Components
- Install individual components using the `add` command:
- ```bash
- npx ai-elements@latest add <component-name>
- ```
- Examples:
- ```bash
- # Install the message component
- npx ai-elements@latest add message
- # Install the conversation component
- npx ai-elements@latest add conversation
- # Install the code-block component
- npx ai-elements@latest add code-block
- ```
- ### Alternative: Use with shadcn CLI
- You can also install components using the standard shadcn/ui CLI:
- ```bash
- # Install all components
- npx shadcn@latest add https://elements.ai-sdk.dev/api/registry/all.json
- # Install a specific component
- npx shadcn@latest add https://elements.ai-sdk.dev/api/registry/message.json
- ```
- ## Quick Start Example
- After installing components, you can use them in your React application:
- ```tsx
- "use client";
- import { useChat } from "@ai-sdk/react";
- import {
- Conversation,
- ConversationContent,
- } from "@/components/ai-elements/conversation";
- import {
- Message,
- MessageContent,
- MessageResponse,
- } from "@/components/ai-elements/message";
- export default function Chat() {
- const { messages } = useChat();
- return (
- <Conversation>
- <ConversationContent>
- {messages.map((message, index) => (
- <Message key={index} from={message.role}>
- <MessageContent>
- <MessageResponse>{message.content}</MessageResponse>
- </MessageContent>
- </Message>
- ))}
- </ConversationContent>
- </Conversation>
- );
- }
- ```
- ## How It Works
- The AI Elements CLI:
- 1. **Detects your package manager** (npm, pnpm, yarn, or bun) automatically
- 2. **Fetches component registry** from `https://elements.ai-sdk.dev/api/registry/registry.json`
- 3. **Installs components** using the shadcn/ui CLI under the hood
- 4. **Adds dependencies** and integrates with your existing shadcn/ui setup
- Components are installed to your configured shadcn/ui components directory (typically `@/components/ai-elements/`) and become part of your codebase, allowing for full customization.
- ## Configuration
- AI Elements uses your existing shadcn/ui configuration. Components will be installed to the directory specified in your `components.json` file.
- ## Recommended Setup
- For the best experience, we recommend:
- 1. **AI Gateway**: Set up [Vercel AI Gateway](https://vercel.com/docs/ai-gateway) and add `AI_GATEWAY_API_KEY` to your `.env.local`
- 2. **CSS Variables**: Use shadcn/ui's CSS Variables mode for theming
- 3. **TypeScript**: Enable TypeScript for better development experience
- ## Contributing
- If you'd like to contribute to AI Elements, please follow these steps:
- 1. Fork the repository
- 2. Create a new branch
- 3. Make your changes to the components in `packages/elements`.
- 4. Open a PR to the `main` branch.
- ---
- Made with ❤️ by [Vercel](https://vercel.com)
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.