{"id":22488877,"url":"https://github.com/run-llama/chat-ui","last_synced_at":"2025-06-23T10:07:33.093Z","repository":{"id":259346560,"uuid":"874505748","full_name":"run-llama/chat-ui","owner":"run-llama","description":"Chat UI components for LLM apps","archived":false,"fork":false,"pushed_at":"2025-06-18T09:27:34.000Z","size":2185,"stargazers_count":388,"open_issues_count":2,"forks_count":41,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-18T09:46:28.190Z","etag":null,"topics":["ai","chat","components","llm","nextjs","react"],"latest_commit_sha":null,"homepage":"https://ui.llamaindex.ai/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/run-llama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-18T00:31:16.000Z","updated_at":"2025-06-18T09:24:30.000Z","dependencies_parsed_at":"2024-10-24T17:27:47.884Z","dependency_job_id":"ba997858-ce51-470d-9a95-d2665cfd0252","html_url":"https://github.com/run-llama/chat-ui","commit_stats":null,"previous_names":["run-llama/chat-ui"],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/run-llama/chat-ui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/run-llama%2Fchat-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/run-llama%2Fchat-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/run-llama%2Fchat-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/run-llama%2Fchat-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/run-llama","download_url":"https://codeload.github.com/run-llama/chat-ui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/run-llama%2Fchat-ui/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261458450,"owners_count":23161178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chat","components","llm","nextjs","react"],"created_at":"2024-12-06T17:18:52.467Z","updated_at":"2025-06-23T10:07:28.079Z","avatar_url":"https://github.com/run-llama.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Open-Source Local LLM Projects"],"sub_categories":[],"readme":"# @llamaindex/chat-ui\n\nChat UI components for LLM apps\n\n## Overview\n\n@llamaindex/chat-ui is a React component library that provides ready-to-use UI elements for building chat interfaces in LLM (Large Language Model) applications. This package is designed to streamline the development of chat-based user interfaces for AI-powered applications.\n\n## Installation\n\nTo install the package, run the following command in your project directory:\n\n```sh\nnpm install @llamaindex/chat-ui\n```\n\n## Features\n\n- Pre-built chat components (e.g., message bubbles, input fields)\n- Minimal styling, fully customizable with Tailwind CSS\n- Custom widgets to extend components (e.g., for rendering generated or retrieved documents)\n- TypeScript support for type safety\n- Easy integration with LLM backends like Vercel Ai\n- Code and Latex styling with highlight.js and katex\n\n## Usage\n\n1. Install the package\n\n```sh\nnpm install @llamaindex/chat-ui\n```\n\n2. Configure your `tailwind.config.ts` to include the chat-ui components\n\n```ts\nmodule.exports = {\n  content: [\n    'app/**/*.{ts,tsx}',\n    'node_modules/@llamaindex/chat-ui/**/*.{ts,tsx}',\n  ],\n  // ...\n}\n```\n\n3. Import the components and use them\n\nThe easiest way to get started is to connect the whole `ChatSection` component with `useChat` hook from [vercel/ai](https://github.com/vercel/ai):\n\n```tsx\nimport { ChatSection } from '@llamaindex/chat-ui'\nimport { useChat } from 'ai/react'\n\nconst ChatExample = () =\u003e {\n  const handler = useChat()\n  return \u003cChatSection handler={handler} /\u003e\n}\n```\n\nThis simple example looks like this:\n\n![output](https://github.com/user-attachments/assets/fdf008a3-52b4-49ef-8db5-c9388d4fb8fa)\n\n## Component Composition\n\nComponents are designed to be composable. You can use them as is:\n\n```tsx\nimport { ChatSection } from '@llamaindex/chat-ui'\nimport { useChat } from 'ai/react'\n\nconst ChatExample = () =\u003e {\n  const handler = useChat()\n  return \u003cChatSection handler={handler} /\u003e\n}\n```\n\nOr you can extend them with your own children components:\n\n```tsx\nimport { ChatSection, ChatMessages, ChatInput } from '@llamaindex/chat-ui'\nimport LlamaCloudSelector from './components/LlamaCloudSelector' // your custom component\nimport { useChat } from 'ai/react'\n\nconst ChatExample = () =\u003e {\n  const handler = useChat()\n  return (\n    \u003cChatSection handler={handler}\u003e\n      \u003cChatMessages /\u003e\n      \u003cChatInput\u003e\n        \u003cChatInput.Preview /\u003e\n        \u003cChatInput.Form className=\"bg-lime-500\"\u003e\n          \u003cChatInput.Field type=\"textarea\" /\u003e\n          \u003cChatInput.Upload /\u003e\n          \u003cLlamaCloudSelector /\u003e {/* custom component */}\n          \u003cChatInput.Submit /\u003e\n        \u003c/ChatInput.Form\u003e\n      \u003c/ChatInput\u003e\n    \u003c/ChatSection\u003e\n  )\n}\n```\n\nYour custom component can use the `useChatUI` hook to send additional data to the chat API endpoint:\n\n```tsx\nimport { useChatInput } from '@llamaindex/chat-ui'\n\nconst LlamaCloudSelector = () =\u003e {\n  const { requestData, setRequestData } = useChatUI()\n  return (\n    \u003cdiv\u003e\n      \u003cselect\n        value={requestData?.model}\n        onChange={e =\u003e setRequestData({ model: e.target.value })}\n      \u003e\n        \u003coption value=\"llama-3.1-70b-instruct\"\u003ePipeline 1\u003c/option\u003e\n        \u003coption value=\"llama-3.1-8b-instruct\"\u003ePipeline 2\u003c/option\u003e\n      \u003c/select\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n## Styling\n\n### Components\n\n`chat-ui` components are based on [shadcn](https://ui.shadcn.com/) components using Tailwind CSS.\n\nYou can override the default styles by changing CSS variables in the `globals.css` file of your Tailwind CSS configuration. For example, to change the background and foreground colors:\n\n```css\n:root {\n  --background: 0 0% 100%;\n  --foreground: 222.2 84% 4.9%;\n}\n```\n\nFor a list of all available CSS variables, please refer to the [Shadcn Theme Config](https://ui.shadcn.com/themes).\n\nAdditionally, you can also override each component's styles by setting custom classes in the `className` prop. For example, setting the background color of the `ChatInput.Form` component:\n\n```tsx\nimport { ChatSection, ChatMessages, ChatInput } from '@llamaindex/chat-ui'\nimport { useChat } from 'ai/react'\n\nconst ChatExample = () =\u003e {\n  const handler = useChat()\n  return (\n    \u003cChatSection handler={handler}\u003e\n      \u003cChatMessages /\u003e\n      \u003cChatInput\u003e\n        \u003cChatInput.Preview /\u003e\n        \u003cChatInput.Form className=\"bg-lime-500\"\u003e\n          \u003cChatInput.Field type=\"textarea\" /\u003e\n          \u003cChatInput.Upload /\u003e\n          \u003cChatInput.Submit /\u003e\n        \u003c/ChatInput.Form\u003e\n      \u003c/ChatInput\u003e\n    \u003c/ChatSection\u003e\n  )\n}\n```\n\n### Code and Latex styling\n\nInside the markdown component, we use [highlight.js](https://highlightjs.org/) for code blocks, [katex](https://katex.org/) for latex, and [pdf-viewer](https://github.com/run-llama/pdf-viewer) for pdf files.\nIf your app is using code, latex or pdf files, you'll need to import their CSS files:\n\n```tsx\nimport '@llamaindex/chat-ui/styles/markdown.css' // code, latex and custom markdown styling\nimport '@llamaindex/chat-ui/styles/pdf.css' // pdf styling\n```\n\nThe `code.css` file uses the `atom-one-dark` theme from highlight.js by default. There are a lot of others to choose from: https://highlightjs.org/demo\nYou can use any of them by copying [their CSS](https://github.com/highlightjs/highlight.js/tree/main/src/styles/) to your project and importing it.\n\n## Example\n\nSee the [example app](./apps/web/README.md) for a complete example. The generate a full-featured project to\nget started with, use [create-llama](https://github.com/run-llama/create-llama).\n\n## License\n\n@llamaindex/chat-ui is released under the [MIT License](LICENSE).\n\n## Support\n\nIf you encounter any issues or have questions, please file an issue on our [GitHub repository](https://github.com/run-llama/chat-ui/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frun-llama%2Fchat-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frun-llama%2Fchat-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frun-llama%2Fchat-ui/lists"}