shadcn-chat
repository·master·Indexed 22 days ago
https://github.com/jakobhoeg/shadcn-chatA collection of customizable and reusable chat components for building chat interfaces. It includes a CLI (shadcn-chat-cli) for installing components such as ChatBubble, ChatInput, ChatMessageList, and ExpandableChat. The library requires Tailwind CSS and shadcn/ui as prerequisites and provides integration examples for the Vercel AI SDK and OpenAI.
What's inside shadcn-chat
- shadcn-chat provides a collection of beautifully designed chat components designed to be copied and pasted directly into your applications. The components are built with a focus on simplicity: they have no external dependencies, no unnecessary bloat, and provide full ownership of the code once integrated.
Use the ChatBubble component
masterTheChatBubblecomponent is the primary component for displaying chat messages, including avatars and actions. To ensure chat bubbles are displayed correctly, you must wrap theChatBubblecomponent within aChatMessageListcomponent.Install all shadcn-chat components
masterTo install every available component from
shadcn-chatat once, run the following command in your project's root directory:npx shadcn-chat-cli@latest add --allComponents will be added to the
src/components/ui/chatdirectory.Create a chatbot with Vercel AI SDK integration
masterTo quickly scaffold a complete Next.js application with the Vercel AI SDK already integrated with
shadcn-chat, use the following command:npx create-next-app --example https://github.com/jakobhoeg/shadcn-chat/tree/master/examples/shadcn-chat-example-vercel-ai nextjs-shadcn-chat-vercel-aiInstall the ChatMessageList component via CLI
masterYou can add the
ChatMessageListcomponent to your project using theshadcn-chat-cli.npx shadcn-chat-cli@latest add chat-message-listPrerequisites for using shadcn-chat
masterBefore installing
shadcn-chatcomponents, ensure your project meets the following requirements:- Tailwind CSS: The components are built using Tailwind CSS.
- shadcn-ui: The components rely on existing
shadcn-uicomponents. You must initializeshadcn-uiin your project before proceeding with theshadcn-chatinstallation.
Bootstrap the Vercel AI SDK chatbot example
masterYou can bootstrap a new Next.js project using this specific
shadcn-chatexample by running thecreate-next-appcommand with the example URL. Replacenextjs-shadcn-chat-vercel-aiwith your desired project name.npx create-next-app --example https://github.com/jakobhoeg/shadcn-chat/tree/master/examples/shadcn-chat-example-vercel-ai nextjs-shadcn-chat-vercel-aiInstall shadcn-chat components via CLI
masterTo add chat components to your project, use the
shadcn-chat-cli. Note that some components depend onshadcn-ui, so ensureshadcn-uiis already installed in your project before proceeding.To install all available components at once (recommended), run:
npx shadcn-chat-cli add --allTo install a specific component, run:
npx shadcn-chat-cli add [component]To see a list of all available components, run:
npx shadcn-chat-cli addnpx shadcn-chat-cli add --allRun the shadcn-chat Vercel AI example locally
masterAfter bootstrapping the project, follow these steps to get the development server running:
- Obtain an API Key: Create an API key in your OpenAI dashboard.
- Configure Environment Variables: Create a
.env.localfile in the project root and add the required environment variables (refer to the example.envfile in the repository for the exact keys). - Install Dependencies: Run
npm install(or your preferred package manager). - Start Development Server: Run
npm run dev.
Install the ExpandableChat component
masterYou can install the
expandable-chatcomponent using theshadcn-chat-cli.npx shadcn-chat-cli@latest add expandable-chatInstall individual shadcn-chat components
masterYou can choose to install only specific components instead of the entire library.
To see a list of all available components, run:
npx shadcn-chat-cli@latest addTo install a specific component, append its name to the command:
npx shadcn-chat-cli@latest add <component-name>Components will be added to the
src/components/ui/chatdirectory.Install the ChatInput component
masterUse the
shadcn-chat-clito add theChatInputcomponent to your project via the following command:npx shadcn-chat-cli@latest add chat-input